开发者

How do I call a Word Macro with parameters from JScript

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜