In Chapter 3, you looked at some simple examples showing how to customize the Ribbon using XML. However, in order to create true custom solutions, you will need to add functionality. This is when Visual Basic for Applications (VBA) comes into play.
This chapter has seven sections, each covering different aspects of VBA, such as recording macros, writing subprocedures and functions, debugging code, and error handling.
Each section builds your knowledge and awareness of VBA. At this stage, the code is as simple as possible. The goal here isn't to teach you all there is to know about VBA, but rather to provide a strong enough foundation for you to interpret, modify, and write code or code snippets to customize the Ribbon.
Bear in mind, however, that this chapter is about learning the basics of VBA in order to add functionality to Ribbon customization; and because the visual effects are accomplished using XML code, which was introduced in Chapter 3, the examples in this chapter don't even work with the Ribbon.
As you are preparing to work through the examples, we encourage you to download the companion files. The source code and files for this chapter can be found on the book's web site at
In Chapter 3 you were introduced to XML code, which is used to add or remove tabs, groups, and controls from the Ribbon. However, just adding those is not enough. ...