开发者

How do I call a Word Macro with parameters from JScript

开发者 https://www.devze.com 2023-04-10 22:26 出处:网络
I have a Word template with a macro defined in the ThisDocument section: Sub Go(pID As Integer, pPassword As String)

I have a Word template with a macro defined in the ThisDocument section:

Sub Go(pID As Integer, pPassword As String)

I am trying to execute this macro from JScript as follows:

application.Run("Go", 1, "secr开发者_开发问答et");

But this fails - what am I doing wrong?


Ok, found one answer:

  1. remove the parameters
  2. use document variables instead:

    document.Variables.Add("id", 1);
    document.Variables.Add("password", "secret");
    application.Run("Go");
    
0

精彩评论

暂无评论...
验证码 换一张
取 消