Export (0) Print
Expand All
Expand Minimize

RUNADDON Function

Last modified: June 17, 2011

Applies to: Office 2013 | Visio 2013

In this article
Syntax
Remarks
Example 1
Example 2
Example 3
Example 4

Executes an add-on or a macro in a Microsoft Visual Basic for Applications (VBA) project.

RUNADDON("string")

Parameters

Name

Required/Optional

Data Type

Description

string

Required

String

The name of an add-on in the Addons collection or a macro in a 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).

Note Note

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.

RUNADDON("Calendar.exe")

Launches an add-on called Calendar.exe.

RUNADDON("Array Shapes")

Launches the (VSL-implemented) add-on whose name is Array Shapes.

RUNADDON("ThisDocument.ReportStatistics")

Calls the ReportStatistics macro in the ThisDocument module in the document project containing this function call.

Note Note

To invoke a macro in the ThisDocument module, you must preface the string with "ThisDocument" as shown.

RUNADDON("ModuleName.ReportStatistics")

Calls the ReportStatistics macro in ModuleName in the document project that contains this function call.

Show:
© 2015 Microsoft