Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / December 2004

Tip: Looking for answers? Try searching our database.

Command line parameter

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Monika Krug - 17 Dec 2004 09:06 GMT
Hello,

I am looking for a command line parameter to specify the
data source for a mail merge document.

I start Word like this:
"C:\Program Files\Microsoft Office\Office11
\Winword.exe" "C:\My Documents\MailMergeMainDocument.doc"
Is there a switch that would tell Word which data source
to connect to?

Or if there is not, maybe it works with a macro?
"C:\Program Files\Microsoft Office\Office11
\Winword.exe" "C:\My
Documents\MailMergeMainDocument.doc" /mMacroThatConnectsDoc
umentToDataSource
Is there a way to specify parameters for a macro on the
command line?
... /mMacroName(param1, param2) or ... /mMacroName -
param1 -param2 maybe?
If this works, how can one get/use these parameters in the
macro?

Any help would be greatly appreciated,
Monika.
Peter Jamieson - 17 Dec 2004 09:16 GMT
You have to use a macro but there is no standard way to recognise the
parameters, so you have to invent your own. Unfortunately the COMMAND
command isn't recognised in Office VBA so you have to use Win32 calls - for
some sample code, go to google groups and search for, e.g.

get microsoft word command line will rickards

Peter Jamieson

> Hello,
>
[quoted text clipped - 21 lines]
> Any help would be greatly appreciated,
> Monika.
Monika Krug - 17 Dec 2004 11:33 GMT
Thanks for the info.

The last posting in the thread at <a
href="http://groups.google.com/groups?hl=de&lr=&ie=UTF-
8&oe=UTF-8&threadm=uYn%23zte8BHA.976%
40tkmsftngp02&rnum=5&prev=/groups%3Fq%3Dword%2520command%
2520line%2520parameters%2520site%253Amicrosoft.com%26hl%
3Des%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26sa%3DN%26tab%
3Dwg">http://groups.google.com/groups?hl=de&lr=&ie=UTF-
8&oe=UTF-8&threadm=uYn%23zte8BHA.976%
40tkmsftngp02&rnum=5&prev=/groups%3Fq%3Dword%2520command%
2520line%2520parameters%2520site%253Amicrosoft.com%26hl%
3Des%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26sa%3DN%26tab%
3Dwg</a> seems to be the only solution:
"Actually, there is one way to "fake it".
You can put the command into a batch file to make it
easier, and before launching Word set an environment
variable, like this:
set myparam=test2
(If doing it in a batch file, make the line
set myparam=%1 and you can issue the parameter as a
command line argument like you are asking).
Then inside Word, using
Environ("myparam")
to retrieve  the value of myparam." (Alex K. Angelopoulos
2002-05-04 microsoft.public.word.vba.addins)

The other suggestion that might work is a VBscript, but I
don't know how to write these.

Monika.

>-----Original Message-----
>You have to use a macro but there is no standard way to recognise the
[quoted text clipped - 20 lines]
>> "C:\Program Files\Microsoft Office\Office11
>> \Winword.exe" "C:\My

Documents\MailMergeMainDocument.doc" /mMacroThatConnectsDoc
>> umentToDataSource
>> Is there a way to specify parameters for a macro on the
[quoted text clipped - 3 lines]
>> If this works, how can one get/use these parameters in the
>> macro?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.