Table of contents
TOC
折叠目录
展开目录

Application.Run 方法 (PowerPoint)Application.Run Method (PowerPoint)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

运行 Visual Basic 过程。Runs a Visual Basic procedure.

语法Syntax

表达式运行( MacroNamesafeArrayOfParams )expression. Run( MacroName, safeArrayOfParams )

表达式_一个表示应用程序对象的变量。_expression A variable that represents an Application object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
MacroNameMacroName必需RequiredStringString要运行的过程的名称。该字符串可包含下列: 加载演示文稿或加载项文件名称后跟感叹号 (!),跟一个句点 (.) 的有效模块名称和过程名称。例如,下面是一个有效的 MacroName 值:"MyPres.ppt !Module1.Test。"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()safeArrayOfParams()必需RequiredVariantVariant要传递给该过程的参数。不能为此参数指定一个对象,也不能对此方法使用命名参数。参数必须按位置传递。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

VariantVariant

示例Example

在本示例中,Main 过程定义一个数组,然后运行宏 TestPass,将该数组作为参数传递。In this example, the Main procedure defines an array and then runs the macro TestPass, passing the array as an argument.

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

概念Concepts

Application 对象Application Object

© 2018 Microsoft