创建过程

模块中的代码将组织到过程中。 过程告知应用程序如何执行特定任务。 使用过程可将复杂的代码任务划分为可管理程度更高的单元。

通过编写代码创建过程

  1. 打开要为其编写过程的模块。

  2. 可以创建 SubFunctionProperty 过程。

  3. 键入 SubFunctionProperty 。 按 F1 获取语法帮助(如有必要)。

  4. 为过程键入代码。 Visual Basic 使用相应的 End SubEnd 函数End Property 语句结束该过程。

使用“插入过程”对话框创建过程

  1. 打开要为其编写过程的模块。

  2. 在“ 插入 ”菜单上,单击“ 过程”。

  3. Type the name for the procedure in the Name box of the Insert Procedure dialog box.

  4. 选择要创建的过程类型: SubFunctionProperty

  5. 将过程的范围设置为 Public 或 Private。

  6. You can select the All Local Variables as Statics to add the Statickeyword to the procedure definition.

  7. 单击“确定”。

另请参阅

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。