Application.Run Method

PowerPoint Developer Reference

Runs a Visual Basic procedure.

Syntax

expression.Run(MacroName, safeArrayOfParams)

expression   A variable that represents an Application object.

Parameters

Name Required/Optional Data Type Description
MacroName Required String The name of the procedure to be run. The string can contain the following: a loaded presentation or add-in file name followed by an exclamation point (!), a valid module name followed by a period (.), and the procedure name. For example, the following is a valid MacroName value: "MyPres.ppt!Module1.Test."
safeArrayOfParams() Required Variant The argument to be passed to the procedure. You cannot specify an object for this argument, and you cannot use named arguments with this method. Arguments must be passed by position.

Return Value
Variant

Example

In this example, the Main procedure defines an array and then runs the macro TestPass, passing the array as an argument.

Visual Basic for Applications
  Sub Main()
    Dim x(1 To 2)
    x(1) = "hi"
    x(2) = 7
    Application.Run "TestPass", x
End Sub

Sub TestPass(x) MsgBox x(1) MsgBox x(2) End Sub

See Also