Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1246
  • Last Modified:

Launch Winword /m to run a macro - how to use preloaded templates in Office\Startup?

Hi,

    I have a number of templates in the Microsoft Office\Office\startup folder, and would like to run one of the macros from a shell command in VB.

    So, my code says something like:

Shell "Winword.exe /mLaunchDocumentWizard"

    This launches Word, but does not run the macro. This does work if I open the document containing the macro first, but this is not an option in my app.

    Info:

The LaunchDocumentWizard subroutine compiles
The LaunchDocumentWizard is a valid macro (public sub, no parameters)


    How do I run a macro without opening the document which contains it?

Thanks,

Nik

0
NikWhitfield
Asked:
NikWhitfield
1 Solution
 
GlowmanCommented:
Nik,

I haven't tried to do this, but just taking a quick glance at your code.  You need to make sure that there is a space between your command line parameter and the macro your trying to initiate.  So instead of
Shell "Winword.exe /mLaunchDocumentWizard"
Shell "Winword.exe /m LaunchDocumentWizard"

???
G
0
 
NikWhitfieldAuthor Commented:
No - there is no space between the switch and the argument.
0
 
DiveblueCommented:
You need to put you macro in the normal.dot template
0
 
CleanupPingCommented:
NikWhitfield:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
DanRollinsCommented:
Moderator, my recommended disposition is:

    Accept Diveblue's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now