Results 1 to 5 of 5
  1. #1
    rpardee
    Guest

    Specifying a macro on the command line--no addins? (W2K SR1)

    Greetings all,

    I'm trying to get word to run a macro with the /m switch on the command line (e.g., c:...WinWord.exe /mMyMacroName).

    I'd like to put the macro in a template file in one of the startup folders, but it looks to me like this is not possible--/m will only work with macros located in normal.dot. Can anybody (dis)confirm this? If it is possible, is there anything I need to do apart from putting the macro in a template that's loading up on startup?

    Thanks!

    -Roy

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Specifying a macro on the command line--no addins? (W2K SR1)

    I'll confirm your hunch -- not possible with /m in any version of Word.

    You could try /L. If that template has an autoexec it should run. Of course, I'd rather not stake my reputation on that statement. <img src=/S/innocent.gif border=0 alt=innocent width=20 height=20>
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Specifying a macro on the command line--no addins? (W2K SR1)

    Roy,

    If you put the code into an AutoExec macro that is in a template that loads at startup, the code will run automatically when Word starts; therefore, why do you need to specify it via the command line switch?

    Gary

  4. #4
    rpardee
    Guest

    Re: Specifying a macro on the command line--no addins? (W2K SR1)

    Many thanks for the very helpful responses Gary & Kevin--this is a great forum.

    Now, since you asked...

    I'm tasked with distributing an application my company bought which uses Word to create 'reports'. These 'reports' are just fixed-column text files saved with a .doc extension and opened in word. The vendor provided three macros that format the text files so they show w/a fixed font, of a size that will prevent unfortunate line wraps.

    The program shells out to Word to open the '.doc' file & uses the /m switch to call one of the three macros to format as appropriate. Unfortunately, we have no control over the vendor's chosen strategy for doing this--don't have source code for it & our requests for changes to this bit have not yet availed us.

    What's worse, the vendor install procs call for overwriting users' Normal.dot files with one that has these macros in them(!). I was hoping to avoid having to do this by instead putting them in an add-in. But no dice...

    But I think I have worked out a method for getting these macros into my users' Normal.dot files without otherwise disturbing them. I've written a VBScript program that uses automation to import a module containing the macros from an exported .bas module file. It's testing well so far...

    Thanks again for the info.

    Cheers,

    -Roy

    P.S. If anybody's interested I can provide the VBScript code...

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Specifying a macro on the command line--no addins? (W2K SR1)

    Might not be helpful in your case, but I stumbled across this on the Microsoft KnowledgeBase:

    <A target="_blank" HREF=http://support.microsoft.com/support/kb/articles/Q181/7/83.ASP>WD97: Unable to Run Macro w/Multiple Command Line Switches</A>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •