Last modified: June 17, 2011
Applies to: Office 2013 | Visio 2013
Executes an add-on or a macro in a Microsoft Visual Basic for Applications (VBA) project.
If the project of the document that contains the RUNADDON function call (or another project if it is referenced) does not have a macro (a procedure with no arguments) named string, Microsoft Visio runs the add-on named string. If no add-on named string can be found, Visio does nothing and reports no error. (You can use the TraceFlags property to monitor the procedures and add-ons that Visio attempts to run.)
When you call a procedure in a standard module, it is recommended that you prefix the string with the module name that contains the procedure (for example, moduleName.procName), because more than one module can have a procedure with the same name.
To call a procedure in a project other than the project of the document that contains the RUNADDON function call, use the syntax projName.modName.procName (you must have explicitly set a reference to projName in your VBA project).
Beginning with Visio 2002, the RUNADDON function cannot execute a string containing arbitrary VBA code. Code that was formerly passed to the RUNADDON function can be moved to a procedure in a document's VBA project that is called from the RUNADDON function.
For more information about running code in Visio, see About Security Settings and Running Code in Visio in this ShapeSheet Reference.
In earlier versions of Visio, this function appears as _RUNADDON. Visio versions 4.0 and later accept either style.