Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Introduction

Introduction

Welcome to the wonderful world of Ribbon customizations. With the advent of Office 2007, users and developers alike are faced with major transitions. Office applications have a whole new look, and the Ribbon is the headliner. While it may have strong appeal to new users, adapting to the Ribbon can be challenging to those of us who are accustomed to the legacy menu and toolbar system. With the advent of the Ribbon, you not only lose the drop-down menus that were always there, but the custom menus and toolbars have also departed. However, we are not stuck with Microsoft's Ribbon which can appear overwhelming with thousands of commands; and you don't need advanced training or mastery of coding languages to tailor the Ribbon to your needs.

That's where this book comes in. Driven by their passion for helping others to enjoy and maximize the experience of working with Office applications, the team of authors has created a resource that enables both users and developers to customize the Ribbon to the extent that they desire. Whether that means replacing the Ribbon with familiar toolbars from prior versions, using photos and labels to personalize commands, or merely creating custom groups of existing tools, the book provides instructions and working examples so that you have the tools and confidence to accomplish your goals. Not only that, but the task can be accomplished using XML and VBA, so there is no need to purchase expensive software or learn complicated programming languages.

You will see that customizing the Ribbon can be fun and rewarding. If you are a developer, you will be empowering users to work more efficiently and you will have new opportunities to tailor both the functionality and the look to specific solutions. Power users will appreciate creating time-saving commands that can easily be shared with associates. In addition, if you are creating customizations for your own purposes, you will enjoy the latitude to truly personalize the appearance of the commands as you structure them for your convenience.

In addition to walking you through the stages for customizing the Ribbon, we also demonstrate how to work with legacy tools. Each chapter presents various options, along with their benefits and drawbacks, so that you can make informed plans and decisions.

Overview of the Book and Technology

Programming and customizing the Ribbon requires a new set of skills, and because the Ribbon is not compatible with previous custom menus and toolbars, developers and power users will immediately begin to seek ways to customize the Ribbon. We are all faced with the choice of either working with the standard Ribbon, replacing the Office Ribbon with a custom Ribbon, or foregoing the Ribbon and installing custom menus and toolbars from previous applications.

RibbonX: Customizing the Office 2007 Ribbon has two key target audiences. The obvious one is power users and developers working in Excel, Access, and Word. However, because average users continue to expand their ability to control their environment, the examples are presented so that a typical user will also be able to work through and implement the processes in total confidence. Therefore, in addition to providing key tips and techniques that developers expect, this book also contains sufficient introductory materials to enable any user to follow the examples and begin to benefit from the efficiencies that can be obtained with a customized Ribbon.

By the time you finish this book and the demo projects, you will have both the knowledge and confidence to customize the Ribbon for the three major components in Office: Excel, Access, and Word. Although the customization process is pretty much the same for the XML code, that doesn't mean the steps are the same for each application — so we scrupulously point out the similarities and differences.

RibbonX: Customizing the Office 2007 Ribbon concentrates on the following:

  • XML development for Ribbon customization

  • Using VBA to add functionality to the custom UI

We are sure that readers will enjoy this book and find it extremely useful as a reference tool for UI customization. It will certainly change the way that one views the new Office UI.

How This Book Is Organized

RibbonX is sure to become the definitive guide to customizing the Ribbon for Excel, Access, and Word. The book is a major resource for power users and developers. It covers the basics in enough detail that even if this is your introduction to writing code, you will learn what you need to know, understand the concepts, and be able to develop and share custom Ribbons and Ribbon components that best suit your needs or those of the intended user.

The material and examples are created using Excel, Access, and Word. We identify when the same procedure applies to all three programs, and we point out any differences among them. The chapters are filled with real-world examples and sample code, so readers will immediately be able to apply their new skills. In many cases, a separate example is used to demonstrate how to incorporate the same feature into each application: Excel, Access, and Word.

The following is a brief summary of what each chapter covers. Although you may not recognize some of the terminology yet, be assured that comprehensive explanations are provided as material is introduced. We also leverage notes, cross-references, and other notes to guide you to reference material and points of particular interest.

To help you build a solid foundation, we start with some background material, covering essential programming processes that you'll need to be familiar with. Chapter 1 discusses the user interface and points out some of the challenges associated with transitioning from menus to the Ribbon, as well as some of the benefits gained with the new UI. Chapter 2 briefly introduces the key components for customizations and how to work with them. You'll learn about XML files, the Office Custom UI Editor, and the USysRibbon table.

In Chapter 3, we lay the foundation for working with XML and explain the various containers that we'll be using — namely, the ribbon, tabs, tab, and group containers. Because this is the first time that developers have been required to use XML with their projects, this chapter will be a handy reference to turn to as you work through subsequent chapters and exercises.

Chapter 4 covers the essentials for working with Visual Basic for Applications code (VBA). If you are an experienced developer, you may breeze right past this chapter, but readers new to programming will learn what they need to know to create successful customizations, including how to work with arrays.

Next, in Chapter 5, we introduce callbacks, which are essentially the hook between the commands on the Ribbon and the code that needs to run. We also explain the processes for invalidating commands and the Ribbon. (Invalidation is a frequently used term throughout the book, so it's important to understand what it is and how it works.)

After that, we start creating new controls. In Chapter 6, you will actually create custom Ribbon commands, beginning with the most common command, the button. We walk you through creating a button, checkBox, editBox, and toggleButton.

Then, in Chapter 7, we explain container controls and show you how to create them. Container controls, which can hold other controls, include the splitButton, the item, the comboBox, and the dropDown control.

Then the creativity really gets to flow in Chapter 8. That's where you learn how to use the icon gallery and add highly personalized touches, such as including custom images in the Ribbon commands.

From there, we move to on to the menu controls in Chapter 9. These are powerful controls, such as the Save As control, that can contain a combination of controls and labels. This means that in addition to creating the controls themselves, you'll become accomplished at formatting the controls to add groupings and clarity.

Chapter 10 provides additional formatting tools, such as the box element, which essentially creates an invisible box for grouping controls. After that, we demonstrate how to place a visible box around a group of controls by using the buttonGroup. To complement these groups, we show you how to use the labelControl to add a heading or a description of other controls. Of course, boxes are not always the ticket, and sometimes just a line is preferable. That's when you'd use the Separator element or the menuSeparator element to insert either a vertical line or a horizontal line, respectively.

That brings us to the last chapter of our fundamentals section. Chapter 11 covers features that provide that extra level of assistance needed to have highly intuitive user interfaces. It also shows you how to make custom help and tips available when users need them the most. This includes attributes such as the keytip, the screentip, and the supertip. We cap it off by showing you how to modify built-in controls.

The next portion of the book deals with advanced concepts. This starts with Chapter 12, which teaches you some advanced VBA techniques that enable you to work with multiple controls at one time. After explaining collections, we demonstrate how to use properties, methods, and events. Then, as somewhat of a bonus, we'll show you how quick and easy it is to incorporate Web services right into your UI, thereby bringing online resources to the user's fingertips.

With all this material under your belt, you are ready to get rid of the Ribbon and literally "start from scratch." That's actually the name of the attribute that removes the built-in Ribbon and commands from the UI. Of course, it isn't as drastic as it might sound, because the Office button and several other commands are still available through shortcuts. Chapter 13 covers all of that and demonstrates how to build a completely custom Ribbon.

However, that isn't the end, because the Ribbon also introduced the Quick Access Toolbar (QAT). The QAT is probably the closest thing on the Ribbon to what we fondly remember as toolbars; and the QAT was designed to do exactly what the name implies, to provide users with instant access to the tools that they most often use. Because the QAT is not context sensitive, the tools are always in the same place. Chapter 14 provides detailed steps for working with and organizing the QAT.

With the Ribbon, the QAT is just the tip of the iceberg when it comes to putting controls at the user's fingertips. We take this to the next level in Chapter 15, where you learn how to create context-sensitive tabs, groups, and controls. These powerful little tools are the best replacement for custom pop-ups. In addition to creating new contextual tabs, we also show you how to modify built-in contextual tables. With those skills, the choice is yours: either start fresh or merely tweak and add to what is provided.

After we've pretty much covered the gamut of customizations, it is time to turn our attention to sharing our solutions. Chapter 16 discusses the issues associated with preparing files and packaging them for deployment. This chapter includes detailed guidance about the reasoning behind the process and walks you through the steps for each application. In addition to deploying complete solutions, we also explore the final RibbonX attribute: The idQ is geared toward sharing elements across files, and it enables users to load and unload Ribbon customizations from a central source.

The final chapter in the book, Chapter 17, explains the security issues that can affect creating, using, and sharing Ribbon customizations. We explain some of the rationale for various security measures, as well as how they can impact your development work and the end user. You also learn about macro-enabled and macro-free file formats, trust centers, and trusted locations. In addition, of course, we share recommendations for providing steps to ensure that users have the appropriate security settings and are still able to enjoy the benefits provided by your customization efforts.

To cap everything off, we include appendixes of reference material so that readers have everything they need at their fingertips. Appendixes cover such topics as naming conventions, and list the correct names for groups, tabs, and other necessary objects in the Ribbon and application hierarchies.

As you can see, this book is everything that we said it would be. It provides the information that you need to immediately achieve results, and it will become an invaluable reference for future projects.

Why Read This Book

This book addresses issues that are daunting multitudes of developers and end users alike. It provides the information and examples that will prepare you to create and share intuitive custom UIs, and it demonstrates the options available for working with legacy custom menus and toolbars.

RibbonX: Customizing the Office 2007 Ribbon is a one-stop reference for anyone who wants to customize the Ribbon. With that goal in mind, it not only works through customizing the Ribbon, but also covers related material. That means the book discusses the basics for working with VBA, XML, and macros. In addition, because macros and VBA trigger Windows security settings, the book also reviews relevant aspects of security, such as trust centers and digital certificates. It also explains issues and processes associated with preparing and packaging customizations for deployment in target environments, including detailed instructions for deploying Access run-time installations.

Whether you are an end user, a seasoned Office developer, or somewhere in between, this book is the perfect reference for customizing and programming the Ribbon.

Tools You Will Need

One of the beauties of this book is that if you have Office 2007, you've already made the prerequisite purchase. That's because we leverage the XML and VBA capabilities that are intrinsic to Microsoft Office 2007, and the additional tools that are available as free downloads from Microsoft. Therefore, contrary to common perception, you can customize the Ribbon without purchasing expensive developer software, such as Visual Studio Tools for Office, and without learning complicated coding languages such as C#.

Your customizations will run on essentially all installations of Office 2007. They can be developed and deployed on both Windows Vista and Windows XP platforms, and it matters little whether these are standard installations or are on virtual machines.

In short, essentially anyone with Office 2007 will be able to work through the numerous examples for Excel, Access, and Word.

What's on the Website

In addition to the material provided in the book, the chapters are supplemented by sample files that can be downloaded from the book's website, www.wiley.com/go/ribbonx. We strongly encourage you to download the files and use them as you work through the exercises.

The online files are invaluable resources that not only provide working demonstrations of the material being covered, but also serve as an ultra-handy source for code snippets. In addition to studying the code in the text, you can use the downloads to view the XML and VBA in their native formats, and you can copy it directly into your own projects.

Some of the files are also nice bonuses in and of themselves. For example, in Appendix C, not only do we provide the source code and file, but our example is actually a fully functional tool that will locate, group, and display the imageMSO for each application. Although you may not realize the value of that yet, you soon will — when you discover that the imageMSO is an integral part of Ribbon customizations. Robert's tool in Appendix C is just one example of how the authoring team has taken extra steps to provide you with the information and resources that you'll need.

Congratulations

We are excited about the opportunity to help fellow developers and end users to customize the Ribbon and create solutions that are both personalized and enhance productivity. You will likely be surprised by how easy it is to create customizations, not only for your own use, but also to share with others.

An exciting bonus for end users is that in addition to customizing your work environment, you will be expanding your horizons, adding new programming skills, and building the confidence to take on bigger and more challenging projects.

We recommend that as you go through the book, you download the sample files so that you can see it in its native environment, see how a finished example will work, and experiment with changes. Working through the exercises will enable you to take ownership of the concepts and incorporate them into your customizations.

Learn, enjoy, be creative. Build solutions that work for you.

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint