MenuItem.IconFileName Method
Visio Automation Reference |
Sets a custom icon file for a menu or toolbar item.
Version Information
Version Added: Visio 4.0
Syntax
expression.IconFileName(IconFileName)
expression A variable that represents a MenuItem object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
IconFileName | Required | String | The path and name of the ICO, EXE, DLL, or VSL file to load. |
Return Value
Nothing
Remarks
The IconFileName method loads the file that contains the icon, saves the bits, and discards the file name.
If the icon contains multiple images, Microsoft Office Visio chooses the best icon, based on both icon size and color depth.
Unless IconFileName is a fully qualified path, the application searches for the ICO, EXE, DLL, or VSL file in the folders indicated by the Application object's AddonPaths property (assuming that the UIObject object is in the Visio process).
Example
This Microsoft Visual Basic for Applications (VBA) macro shows how use the IconFileName method to set the icon for a toolbar button. It retrieves a copy of the built-in Visio toolbars, adds a toolbar button, and sets the button icon.
Before running this code, replace path\filename with the full path to and name of a valid icon (.ico file) on your computer.
To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.
Visual Basic for Applications |
---|
|
See Also