Login|Contact Us
Question and Answer

Computer

Ask a Computer Question, Get an Answer ASAP!

  • Ask A Question
  • Browse Answers
  • Meet The Experts
  • How JustAnswer Works

How do I start MS Word from the command line using the /m ...

 
Network Engineer's Avatar
  • Answered by:Network Engineer
  • Computer Hardware Engineer
  • Positive Feedback: 92.0 %
  • Accepted Answers: 89
Verified Expert
in Computer

Recent Feedback

Positive
Correct answer but later than I needed. By the time I received it I had already...
Positive
thank you i thought that too
Positive
This is my first time to do this thing and I will do again for future help....
Positive
appreciate the help
Positive
Great job!! Gave me several options in one answer. I found the one that...
Positive
The information provided seemed to satisfy my need to know if a certain program...
Positive
I hope the links help!
Positive
Appreciate the help; he kept trying until he pointed me in the right direction.
Positive
Very much on top of every thing!

Customer Question

How do I start MS Word from the command line using the /m command line switch to run a mcro that is not in the normal.dot template?

 

Optional Information:
OS: Windows XP; Browser: IE

Already Tried:
Microsoft and MSDN support plus a google search.

Submitted: 2116 days and 8 hours ago.
Category: Computer
Value: $15
Status: CLOSED

Accepted Answer

Picture
Expert:  Network Engineer replied 2116 days and 8 hours ago.

/m Starts a new instance of Word without running any AutoExec macros.
what you want is

/mmacroname Starts Word and then runs a specific macro. The /m switch also prevents Word from running any AutoExec macros.
so it would be

C:\Program Files\Microsoft Office\Office\Winword.exe /mmacroname


http://support.microsoft.com/kb/210565

Expert TypeComputer Hardware Engineer
Category: Computer
Pos. Feedback: 92.0 %
Accepts: 89
Answered: 6/20/2007

Experience: 30 Years Experience Hardware and Software Support,Mac OS X, Expert.

Ask this Expert a Question >
Customer replied 2116 days and 8 hours ago.

This works fine for macros that are in the normal.dot global template; however, I am trying to reference a macro in another template that I have placed in the startup directory for Word and it still refuses to work. I had thought there was some way to specify the actual location of the macro such as template.module.macro but that failed too.

Picture
Expert:  Network Engineer replied 2116 days and 8 hours ago.

/ttemplatename Starts Word with a new document based on a template other than the Normal template.

thats about it accourding to there support site.
You used to be able to do that in the older versions,Word.Template.x, where x represents MS-Word version .... Macro.1, Microsoft Access module macro, Can contain malicious behavior so they stopped people from doing it.

Customer replied 2116 days and 8 hours ago.

The /t and /m switches cannot be used together and there are numerous macros within the template rather than any autoexec macro.

Picture
Expert:  Network Engineer replied 2116 days and 7 hours ago.

The DOT template is the first document opened when you launch MS Word.

If a macro named AutoExec is in the "normal.dot" template or in a global template stored in Word's startup directory, it is executed

Customer replied 2116 days and 7 hours ago.

Would I then somehow use the autoexec macro to launch the desired macro within the other module based on the document name or do I need to create numerous global templates each with an autoexec macro and specify them on the startup line acordingly depending on the document I am loading? I got an autoexec macro to work in the global template I had created (not normal.dot) but it doesn't want to launch the macro I really want to run; perhaps I am referencing it incorrectly on the application.run command or should be trying another command.

Thanks for all your help.

Picture
Expert:  Network Engineer replied 2116 days and 7 hours ago.

rename normal.dot to backup.dot and name yours normal.dot and see if that works.

I did see this tho om the support site.
When you run a Visual Basic For Applications macro containing the "Application.Run Macroname:=" command in Microsoft Word or in another Office program to automate Word, you may receive the following error message:
Run Time error '4366' : Unable to run the specified macro.

CAUSE
You have included a template name as part of the Macroname argument string.
Back to the top

RESOLUTION
Remove the template name from the Macroname argument.

http://support.microsoft.com/kb/190235Network Engineer39253.5599894676

Customer replied 2115 days and 9 hours ago.

I have been able to create an autoexec macro in the global template and it works fine when I specify that template name using the /t switch on the command line as long as it is located in my startup directory. Unfortunately, it does not work if I open any other document by double clicking on it or simply try opening Word. The macro assigns the activedocument.name value to a variable which is then used to determine which other macro to run. This now creates a run-time error 4248 (command is unavailable because there is no document open). If I move the template from the startup directory to another location, the problem goes away but the autoexec macro will not run even with the /t switch (even if it is my templates directory). Now I need a awy around this run-time 4248 error and am not having any luck finding it on any microsoft support sites including MSDN.

I've tried the workarounds that are suggested on the Microsoft site using the error handler to trap the error and exit the macro; however, this completely defeats the purpose of having an autoexec macro. I will now see what happens if I comment out the entire autoexec macro and call the individual macros by name with the template still in the startup directory but have my doubts.

Any ideas?

I'm paying now as my initial question has been answered.

Thank you.

Picture
Expert:  Network Engineer replied 2115 days and 9 hours ago.

Found it here for you..
as how to fix it is beyond me .
http://support.microsoft.com/kb/813983

Run-time error '4248':
This command is not available because no document is open.
Back to the top

CAUSE:
This problem may occur if you do not have a document open, or if the document that you are referencing is not open. Word can only change the properties of an open (or visible) document.

Note These error messages may also appear if you open the document with the Visible property set to False.

 
Tweet

25 Tech Support Specialists are Online Right Now

Ask Your Question Now
Computer Questions Date Submitted
The last few days when using the computer to look up real estate, 3/28/2013
Using Incredimail to Export Data and Settings from old computer 3/28/2013
I scan quite a few magazine articles into my computer and store 3/28/2013
Brother DCP-167C Printer. Cannot get scanner to work. I 3/28/2013
I currently have a computer with an Asus M2A-VM Micro ATX motherboard 3/28/2013
unable to open pdf's in Browser 3/28/2013
Incoming phone calls get routed to my computer but my phone 3/28/2013
I cannot get my computer to recognize my scanner/printer. 3/28/2013
I have a new Toshiba P850 with Windows 8. When I typed some 3/28/2013
I am trying to use Nero 12 to transfer video from a Canon Video 3/28/2013
RSS
Next 10 >
Ask A Tech Support Specialist
Type Your Computer Question Here...
characters left:

Top Computer Experts

See More Tech Support Specialists

In The News

Nbc
Washington Post
New York Times
Cnn
Learn More

How It Works

  • Ask an Expert
  • Get a Professional Answer
  • Ask Followup Questions
  • 100% Satisfaction Guarantee
Learn More
close
Find Expert answers related to your question.
Sign up using email
We will never post anything without your permission.
Already have an account? Sign in

Ask a Tech Support Specialist

Get a Professional Answer. 100% Satisfaction Guaranteed.
221 Tech Support Specialists are Online Now
Type Your Computer Question Here...
characters left:
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
Truste
Contact Us | Terms of Service | Privacy & Security | About Us
© 2003-2013 JustAnswer LLC