会计学习js宏有用吗

JavaScript015

会计学习js宏有用吗,第1张

有用

js好用,更强大,js的优势在于web交互,还有众多的第三方框架,库等,加上现在bs架构越来越流行,js的优势还是很明显的。因此js宏有用。

wps宏编辑器集成了一个V8引擎的JAVAScript运行时,支持大部分ES6语法,用户可通过编写JS脚本来加速执行日常任务,还可以使用JS为WPSoffice添加新功能。

Word 开发人员参考

Application.Run 方法

运行 Visual Basic 宏。

语法

表达式.Run(MacroName, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11, varg12, varg13, varg14, varg15, varg16, varg17, varg18, varg19, varg20, varg21, varg22, varg23, varg24, varg25, varg26, varg27, varg28, varg29, varg30)

表达式 必选。一个代表 Application 对象的变量。

参数

名称 必选/可选 数据类型 说明

MacroName 必选 String 宏的名称。

varg1...varg30 可选 Variant 宏参数值。最多可以给指定宏传递 30 个参数值。

说明

MacroName 参数可以是任意模板、模块和宏名的组合。例如,下列语句均有效。

Visual Basic for Applications

Application.Run "Normal.Module1.MAIN"

Application.Run "MyProject.MyModule.MyProcedure"

Application.Run "'My Document.doc'!ThisModule.ThisProcedure"

如果指定了文档名,则此代码只能运行与当前环境有关的文档中的宏,而不是任何文档中的任何宏。

虽然 Visual Basic 代码可直接调用宏(无需使用 Run 方法),但当宏名存储在变量中时该方法仍很有用。(有关详细信息,请参见本主题示例。)下面三条语句作用相同。前两条语句需要引用 Normal.dot(被调用宏所在的项目);第三条语句由于使用 Run 方法,因此无需引用 Normal.dot 项目。

Visual Basic for Applications

Normal.Module2.Macro1

Call Normal.Module2.Macro1

Application.Run MacroName:="Normal.Module2.Macro1"

示例

本示例提示用户输入模板名、模块名、宏名以及参数值,然后运行该宏。

Visual Basic for Applications

Dim strTemplate As String

Dim strModule As String

Dim strMacro As String

Dim strParameter As String

strTemplate = InputBox("Enter the template name")

strModule = InputBox("Enter the module name")

strMacro = InputBox("Enter the macro name")

strParameter = InputBox("Enter a parameter value")

Application.Run MacroName:=strTemplate &"." _

&strModule &"." &strMacro, _

varg1:=strParameter