Microsoft KB Archive/254938
PSS ID Number: 254938
Article Last Modified on 8/5/2004
The information in this article applies to:
- Microsoft Visio 2000 Standard Edition
- Microsoft Visio 2000 Professional Edition
- Microsoft Visio 2000 Technical Edition
- Microsoft Visio 2000 Enterprise Edition
- Microsoft Visio Standard 5.0x
- Microsoft Visio Professional 5.0x
- Microsoft Visio Technical 5.0x
- Microsoft Visio Enterprise 5.0x
- Microsoft Visual Basic for Applications
This article was previously published under Q254938
You can use the AddonName property of a MenuItem or ToolbarItem object to pass arguments to a function in a VBA project. This article provides some sample code that demonstrates how to do this.
Suppose you have a private function named MyAddon in the ThisDocument module of a VBA project:
Private Sub MyAddon(arg1 As Integer, arg2 As String)
To pass arguments to the MyAddon function, you could use the following line of code:
visToolbarItem.AddOnName = "ThisDocument.MyAddon 0, ""Test Button 1"" "
In this example, visToolbarItem is a ToolbarItem object. MyAddon is your private function. The values 0 and Test Button 1 are the arguments that will be passed to the MyAddon function. Note that the order of the arguments as well as their types must match the order and types in the function declaration.
To see a Visio 5.0 file that contains this sample code, download 2156.exe. The following file is available for download from the Microsoft Download Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
Keywords: kbdownload kbdtacode kbfile kbGraphxLink kbhowto KB254938
Technology: kbVBASearch kbVisio2000Search kbVisio500xSearch kbVisioSearch kbZNotKeyword3 kbZNotKeyword6