Home All Groups Group Topic Archive Search About

Opening word with Process.start

Author
15 Feb 2006 6:21 PM
Thomas Beyerlein
I am trying to open word with process.start but when it opens word it
give me a error that says:
Word experienced an error
Try suggestions:
* check the file permissions
* Make sure there is sufficient free memory
* Open the file with the text recovery

I think it is some thing with word. Any suggestions??

Thanks
Tom

He is my code

Dim diWord As DirectoryInfo = New
DirectoryInfo("C:\ProgramFiles\Microsoft Office\Office11\WINWORD.exe")
If diWord.Exists Then
wrdApp = "C:\Program Files\Microsoft Office\Office11\WINWORD.exe"
Else
wrdApp = "C:\Program Files\Microsoft Outlook\Office11\WINWORD.exe"
End If
'set open dialog properties
With Me.OpenFileDialog1
.Filter = "PDF (*.pdf) | *.pdf|all files (*.*)|*.* | Word Documents
(*.doc) | *.doc"
.FilterIndex = 3
.InitialDirectory = path
.Title = "Open File Dialog"
End With

'show the open dialog and if the user click the ok button
'load the file
If Me.OpenFileDialog1.ShowDialog = DialogResult.OK Then

'Get File name
strFileName = Me.OpenFileDialog1.FileName
MsgBox(Me.OpenFileDialog1.FileName)

Process.Start(wrdApp, strFileName)

End If

End Sub



*** Sent via Developersdex http://www.developersdex.com ***

Author
15 Feb 2006 6:58 PM
Patrice
Write down the command to see if it looks correct? You could also launch the
..doc file. It will launch the associated Word application...

--
Patrice

Show quoteHide quote
"Thomas Beyerlein" <tb***@yahoo.com> a écrit dans le message de
news:O69VTylMGHA.536@TK2MSFTNGP09.phx.gbl...
>
> I am trying to open word with process.start but when it opens word it
> give me a error that says:
> Word experienced an error
> Try suggestions:
> * check the file permissions
> * Make sure there is sufficient free memory
> * Open the file with the text recovery
>
> I think it is some thing with word. Any suggestions??
>
> Thanks
> Tom
>
> He is my code
>
> Dim diWord As DirectoryInfo = New
> DirectoryInfo("C:\ProgramFiles\Microsoft Office\Office11\WINWORD.exe")
> If diWord.Exists Then
> wrdApp = "C:\Program Files\Microsoft Office\Office11\WINWORD.exe"
> Else
> wrdApp = "C:\Program Files\Microsoft Outlook\Office11\WINWORD.exe"
> End If
> 'set open dialog properties
> With Me.OpenFileDialog1
> Filter = "PDF (*.pdf) | *.pdf|all files (*.*)|*.* | Word Documents
> (*.doc) | *.doc"
> FilterIndex = 3
> InitialDirectory = path
> Title = "Open File Dialog"
> End With
>
> 'show the open dialog and if the user click the ok button
> 'load the file
> If Me.OpenFileDialog1.ShowDialog = DialogResult.OK Then
>
> 'Get File name
> strFileName = Me.OpenFileDialog1.FileName
> MsgBox(Me.OpenFileDialog1.FileName)
>
> Process.Start(wrdApp, strFileName)
>
> End If
>
> End Sub
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***