Article ID: 173707 - Last Review: March 29, 2007 - Revision: 3.6 OFF97: How to Run Sample Code from Knowledge Base Articles
This article was previously published under Q173707 For a Microsoft Office XP version of this article,
see
290140
(http://support.microsoft.com/kb/290140/EN-US/
)
. For a Microsoft Office 2000 version of this article, see 212536 (http://support.microsoft.com/kb/212536/EN-US/ ) . For a Microsoft Office 2001 for Mac version of this article, see 274703 (http://support.microsoft.com/kb/274703/EN-US/ ) . For a Microsoft Office 98 Macintosh Edition version of this article, see 181058 (http://support.microsoft.com/kb/181058/EN-US/ ) . On This PageSUMMARY The Microsoft Knowledge Base contains a number of articles
that contain sample code for Visual Basic for Applications macros. Many of
these macros illustrate basic concepts of programming in Visual Basic for
Microsoft Office. This article contains instructions on how to use the sample
code to create a new macro, and how to run that macro. MORE INFORMATIONMicrosoft 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 Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104) Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice) For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms) Microsoft Excel stores macros in workbooks; Microsoft PowerPoint stores macros in presentations, and Microsoft Word stores macros in templates and documents. To use the sample code in a Knowledge Base article, you must add a new Visual Basic macro (or select an existing macro) in an Excel workbook, PowerPoint presentation or Word template or document. You can then paste or type the sample code into this macro. Use any of the following methods. To Create a New 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:
To Run the Macro
REFERENCES 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: 163435
(http://support.microsoft.com/kb/163435/EN-US/
)
VBA: Programming Resources for Visual Basic for Applications
APPLIES TO
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email

Back to the top
