laiseng

how do i pass parameter to winword.exe
and how do i access that parameter to winword.exe using VSTO2005SE

let say i want to pas winword.exe 100 and i would like to read the 100 and
do computation before i open the document


Re: Visual Studio Tools for Office parameter passing to winword.exe

Geoff Darst - MSFT

Hi,

Word has no facility for allowing arbitrary parameters to be passed (and retrieived) from the command line. If there is a specific problem you are trying to solve, let us know and perhaps we can suggest an alternative solution.

Sincerely,

Geoff Darst

Microsoft VSTO Team





Re: Visual Studio Tools for Office parameter passing to winword.exe

laiseng

oh...

too bad...

i am developing web application which will allow the user to launch word and pass parameter to the word application before opening the document

for example,
i can pass the parameter of the name of the person who open the word document from our web service and then in the document it will automatically print that person name.

not just for printing the text in the document, i would be able to pass value to the word document to do computation before printing the computed result in the word document.
=========================================================

anyway, i've got a way around it by creating a text file first with the parameter that i would like the word to receive and when the word document launch, it will read from the text file and do something with it before print them on the document.

one problem with this method is that i cant control when the read from text file should be executed. The best i can do is when the customtaskpane load even happen. i cannot use document open event to start the read from text file. So to get around it, i've execute the read from text file on customtaskpane loaded and reopen the doc file again...


it would be nice if the word will accept parameter...

this should be included in the next release of VSTO









Re: Visual Studio Tools for Office parameter passing to winword.exe

KenMcCormack

I've got a Word add-in that displays a windows form on load, to grab an ID from the user.

When I open the doc from within a unit test, the add-in form is firing, which means I can't automate the test -

It would be nice to pass an Xml chunk to the in the Documents.Open() call, which could then be read in the 'on open' event handler...





Re: Visual Studio Tools for Office parameter passing to winword.exe

Cindy Meister

Hi Ken

Basically, you store such information somewhere and have the Open method read it. In the classic VB-world, this would be a Registry entry or a text file (INI, XML, csv...). In the .NET world, you have other options, such as a web service. Why not use the .NET debugging to add a call to whatever "provider" you decide to use. Then when you compile for distribution it will be stripped out...