Re: triggering macros with parameters

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Chad DeMeyer (cjdemeye_at_bechtel.com)
Date: 05/25/04


Date: Tue, 25 May 2004 11:20:57 -0700

Jake,

The Run method of the Application object in Word will accept up to 30
parameters. E.g.,

WD.Run "Project.Module1.Macro1", arg1, arg2, ... arg30

where arg1, arg2, etc. are the parameters you wish to send to the procedure
or function. Of course, those parameters need to be defined in the
declaration, e.g.,

Sub MySub(param1 as String, param2 as Integer, ... param30 as Object)

Hope this helps.
Regards,
Chad

"Jake Williams" <anonymous@discussions.microsoft.com> wrote in message
news:2c5a01c42877$1f602370$a501280a@phx.gbl...
> Is it possible to trigger a macro with parameters using
> vbScript? If so, could you please post the code or
> provide a link to the information.
> Here is what I am doing thus far...but it will not work
> if I have parameters.
>
> Dim WD
> Set WD = CreateObject("Word.Application")
> WD.Documents.Open "C:\word.Doc"
> WD.Run "Project.Module1.Macro1"
> WD.Close



Relevant Pages

  • NORAD SGP4/SDP4
    ... "The enclosed Pascal source code implements the NORAD SGP4/SDP4 orbital ... models for use with the standard two-line orbital element sets to ... if arg1 < arg2 then ...
    (comp.lang.forth)
  • Re: Overloading methods...
    ... public static double Add(double arg1, double arg2) ... Note that sometimes you get into trouble with overload resolution. ... C# doesn't currently support generic operator usage, so there's no really any graceful way to do the above using generics. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Runtime.getRuntime().exec() append the parameters
    ... so no necessary to set environment ... But When I excute the same in command prompt it works fine. ... What exactly are the values of arg1 and arg2. ...
    (comp.lang.java.programmer)
  • Re: Function call as a query attibute...
    ... that Arg1 and Arg2 are other fields in the query. ... something in the Criteria row under this calculataed field, ...
    (microsoft.public.access.modulesdaovba)
  • Re: can I do windows shell scripting in ruby?
    ... COMMAND and inserts the output into the doublequoted string. ... Imagine the arg1 came from the web! ... Or make sure and doublesure the arg1 and arg2 only ... contains stuff that's safe. ...
    (comp.lang.ruby)