O'Reilly logo

Excel 2003 VBA Programmer's Reference by Robert Rosenberg, Rob Bovey, John Green, Stephen Bullen, Paul T. Kimmel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

14

Customizing the VBE

There is an object library provided that is shown as Microsoft Visual Basic for Applications Extensibility 5.3 in the VBE's Tools images References list. The objects in this library and their methods, properties, and events enable us to:

  • Programmatically create, delete, and modify the code, UserForms, and references in our own, and other workbooks
  • Program the VBE itself, to create useful Addins to assist us in our development efforts and automate many of your development tasks

Between Office 97 and Office 2000, the Click event was added to the CommandBarButton object, which is used to respond to the user clicking the buttons that we add to the VBE's commandbars. The Addin will not, therefore work in Office 97, although all of the code that manipulates the VBE and its objects is still applicable.

The one difference introduced between Excel 2000 and Excel 2002 is related to security. Macro viruses work by using the methods shown in this chapter to modify the target file's code, thus infecting it. To prevent this, Microsoft has made it possible to disable access to all workbooks VBProjects. By default, access is disabled, so none of the code in this chapter will work. To enable access to the VBProjects, check the Trust Access to Visual Basic Project check box on Excel 2003's Tools Macros Security Trusted Sources dialog box.

This chapter explains how to write code ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required