Article ID: 297304 - View products that this article applies to.
This article was previously published under Q297304
This article has been archived. It is offered "as is" and will no longer be updated.
For a Microsoft Visio 2000 version of this article, see 277011
The Microsoft Knowledge Base contains many 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 Visio. 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. Microsoft Visio stores macros in a module within a project that is stored in a template (.vst), a stencil (.vss), or a drawing (.vsd). To use the sample code in a Knowledge Base article, you must first add a new Visual Basic macro (or select an existing macro) in a Visio template, stencil, or drawing. Then you can paste or type the sample code into this macro.
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
the macro security level in Visio is set to High, or macros are disabled.
The macros in the project are disabled. Please refer to the online help or documentation of the host application determine how to enable macros.
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/297136/EN-US/ )Visio2002: "The Macros in the Project Are Disabled" Message When You Run a Macro
Microsoft Visio Help 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 forApplications, click the article number below to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/297319/EN-US/ )Visio2002: Programming Resources for Visual Basic for Applications