OFF2000: How to Run Sample Code from Knowledge Base ArticlesID: Q212536
|
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 2000 applications. 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, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals 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 needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.aspTo 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/paste or type the sample code into this macro by using any of the following methods:
Sub macroname() Type your macro code here End Sub
-or-
After typing or pasting the code for your macro, on the File menu, click Close and Return to Microsoft <application>Sub macroname() End Sub
- Switch to the program that you are using to view the Microsoft Knowledge Base article, such as Microsoft Internet Explorer.
- To select the sample code, hold the CTRL key and then single-click the code.
- On the Edit menu, click Copy.
- Switch to the Visual Basic Editor.
- In the Visual Basic Editor, select the existing code text of Sub Macroname() to the End Sub of the macro.
- On the Edit menu, click Paste.
NOTE: When you paste, the existing code text will be replaced with the code you copied from the Knowledge Base article.
Microsoft Help for each Office program contains numerous topics about
working with macros. Visual Basic Help contains extensive information about
writing your own code.
For additional information about getting help with Visual Basic for
Applications, please see the following article in the Microsoft Knowledge
Base:
Q226118 OFF2000: Programming Resources for Visual Basic for Applications
Additional query words: vba vbe visual basic OFF2000
Keywords : kbmacro kbprg kbdta kbwordvba wd2000
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto kbinfo
Last Reviewed: July 26, 1999