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

Part VIII: Customizing and Automating Ex... > Introducing Visual Basic for Applica...

Chapter 46. Introducing Visual Basic for Applications

  • Create a procedure with the Macro Recorder

    Microsoft Excel's Macro Recorder is a great tool for automating common tasks.

  • Run a procedure

    To run a procedure you can use Tools, Macro or you can assign a macro to a button.

  • Edit a procedure

    The Visual Basic Editor allows you to make changes to your original recorded macro.

  • Use data-entry boxes

    Using a Visual Basic function called InputBox, you can prompt a user for information.

  • Display a message

    The MsgBox function allows you to display messages when a user runs a procedure you create.

For a number of years, Microsoft has hinted to the press and developers that its long-range strategy included a common application programming language used in all its applications. This language would be founded on BASIC, the most widely known computer language, and would provide power users and developers with a common application language (also known as macro language) between applications. This feature would reduce learning time and support costs. In addition, this language would provide the means for developers to develop systems that integrate multiple applications—enabling multiple applications to work together to solve business problems.

That long-awaited language is Visual Basic for Applications (VBA). The first Microsoft products to include the language were Excel 5 and Project 4. Visual Basic for Applications offers power users and developers the ability to use the most common Windows programming language, Visual Basic, and apply it to Excel problems. It also enables users to more easily control other Microsoft applications. In Office 97, the Microsoft Office suite of applications uses Visual Basic for Applications. If you are an experienced Excel 4 macro programmer, you may face the transition to Visual Basic for Applications with mixed feelings. You probably have Excel systems that use the existing Excel 4 language as well as having hundreds of hours of learning and development in the Excel 4 language. Part of what you feel may be ambivalence. You are looking forward to a more powerful, easier-to-use language shared between Microsoft applications, yet at the same time you hate to think of redeveloping applications and learning an entirely new language.

If you are an experienced Excel 5 or 7 Visual Basic for Applications developer, you will notice some changes from previous versions. You'll be happy to know that the majority of the changes have to do with the development environment, not the language. The most apparent change is to the Visual Basic Editor. The Visual Basic Editor now exists outside of the Microsoft Excel host application window. Even though the Visual Basic Editor does exist outside of the host application window, it still resides in the same memory space as the host application, in this case, Excel. The advantage of this approach is that other Office 97 applications have the same look to their development environments.

Some of the other new features to this release include:

  • Support for ActiveX controls

  • The Project Explorer, which displays a list of components, such as modules, that make up a project

  • An improved object browser

  • The property window, which displays properties and their settings for forms and ActiveX controls.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint