Running MS Word in VB.net with a switch

  • Thread starter Thread starter Dean Richardson
  • Start date Start date
D

Dean Richardson

Hello,

We are currently running Word in a form OK. However, we need to run a
dedicated instance. In order to run this instance, as a service we use
the following code:

Dim p As New ProcessStartInfo("winword.exe", "/x")
Process.GetCurrentProcess().StartInfo = p

Currently to execute word in vb.net so that we can get a handle on it,
we use:

dim wrdapp as New Word.Application.

Is there a way to have wrdapp run the application with the /x switch
as we need to get a handle on the application to open documents within
this.

Thanks in Advance,
Dean
 
Hello,

We are currently running Word in a form OK. However, we need to run a
dedicated instance. In order to run this instance, as a service we use
the following code:

Dim p As New ProcessStartInfo("winword.exe", "/x")
Process.GetCurrentProcess().StartInfo = p

Currently to execute word in vb.net so that we can get a handle on it,
we use:

dim wrdapp as New Word.Application.

Is there a way to have wrdapp run the application with the /x switch
as we need to get a handle on the application to open documents within
this.

Thanks in Advance,
Dean

Forgive my ignorance, but what does the /x switch do? I don't know of
a way to use Office Interop with command line switches, but it might
be possible to recreate the functionality provided by /x.

Thanks,

Seth Rowe
 
Here's how I am doing this:

Dim iPropNum As Integer
iPropNum = dgProposals.Item(dgProposals.CurrentRowIndex, 0)
'' Declare the variable.
Dim objWD As Word.Application
' Set the variable (runs new instance of Word.)
objWD = CreateObject("Word.Application")
' Add a new document.
objWD.Documents.Open(dgProposals.Item(dgProposals.CurrentRowIndex, 1))
'make visible for editing
objWD.Visible = True

hope this helps,
george hardy
 
Forgive my ignorance, but what does the /x switch do? I don't know of
a way to use Office Interop with command line switches, but it might
be possible to recreate the functionality provided by /x.

Thanks,

Seth Rowe- Hide quoted text -

- Show quoted text -

Hi,

According to the MS KB article - it opens up a new instance of word
that only has one DDE request. The KB article can be found at:

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

Thanks,
Dean
 
Back
Top