Article ID: 290140 - View products that this article applies to.
This article was previously published under Q290140
For a Microsoft Office 2000 version of this article, see 212536
For a Microsoft Office 97 version of this article, see 173707
For a Microsoft Office 2001 for Mac version of this article, see 274703
For a Microsoft Office 98 Macintosh Edition version of this article, see 181058
The Microsoft Knowledge Base contains a number of articles that include sample code for Visual Basic for Applications macros. Many of these macros illustrate basic concepts of programming in Visual Basic for the various Office XP programs. This article contains instructions on how to use the sample code to create a new macro, and how to run that macro.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To use the sample code from a Knowledge Base article, you must add a new Visual Basic macro (or select an existing macro). You can then copy-and-paste or type the sample code into this macro by using any of the following methods.
To Create a New Macro
NOTE: Use the TAB key to indent text. Lines that begin with an apostrophe (') are comments and are not required to run the macro. However, you may want to type them to make it easier to understand the macro.
To Add the Sample Code to a ModuleTo add code to a module, you must either have an existing module or create a new module. To do this, follow these steps:
where program is the Microsoft Office XP program that you are using.
To Run the Macro
Microsoft Help for each Office program contains numerous topics about working with macros. Visual Basic Help contains extensive information about writing your own code.
Article ID: 290140 - Last Review: May 7, 2007 - Revision: 3.5