Home All Groups Group Topic Archive Search About

Process.Start("WinWord.exe") problem

Author
30 Mar 2005 12:34 PM
Dean Slindee
The code below is being used to launch WinWord.exe from a VB.NET program.
Word launches, but displays this error message:

"Word has experienced an error trying to open the file.  Try these
suggestions. 1) Check the file permissions for the document or drive. 2)
Make sure there is sufficient free memory and disk space. 3) Open the file
with the Text Recovery converter."

The document that I want to display is on my PC and was created by me.  I
ultimately want users to be able to open the document in READONLY mode, if
possible.  Is
there a security switch in the Process.Start statement that I can set to
override the error message?  Security switch for readonly access?

Here is the code:

   Private Sub frmAppointmentWorker_HelpRequested(ByVal sender As Object,
ByVal hlpevent As System.Windows.Forms.HelpEventArgs) Handles
MyBase.HelpRequested

      Dim strHelpDocumentPath As String

      'determine whether a Help file exists

      strHelpDocumentPath = gstrHelpPath & Me.Name & ".doc"

      If File.Exists(strHelpDocumentPath) Then

         'launch Word

         Process.Start("WinWord.exe", strHelpDocumentPath)

         'Process.Start("WinWord.exe", "C:\Projects\Human
Services\Documents\Help\frmAppointmentWorker.doc") 'the string in
strHelpDocumentPath

      Else

         MessageBox.Show("A Help document for " & Me.Name & " does not yet
exist.", "Help document not found", MessageBoxButtons.OK,
MessageBoxIcon.Information)

      End If

      hlpevent.Handled = True

   End Sub



Thanks in advance,

Dean Slindee

Author
30 Mar 2005 1:16 PM
Robin Tucker
You could try an exception handler to catch this message around your process
start.  I assume it starts and opens the document in any case, so all you
want to do is prevent it throwing out of your program.

try

    Process.Start

Catch whatevertheexceptionisCOMException

End Try


Show quoteHide quote
"Dean Slindee" <slin***@charter.net> wrote in message
news:J1x2e.24$Ba5.17@fe03.lga...
> The code below is being used to launch WinWord.exe from a VB.NET program.
> Word launches, but displays this error message:
>
> "Word has experienced an error trying to open the file.  Try these
> suggestions. 1) Check the file permissions for the document or drive. 2)
> Make sure there is sufficient free memory and disk space. 3) Open the file
> with the Text Recovery converter."
>
> The document that I want to display is on my PC and was created by me.  I
> ultimately want users to be able to open the document in READONLY mode, if
> possible.  Is
> there a security switch in the Process.Start statement that I can set to
> override the error message?  Security switch for readonly access?
>
> Here is the code:
>
>   Private Sub frmAppointmentWorker_HelpRequested(ByVal sender As Object,
> ByVal hlpevent As System.Windows.Forms.HelpEventArgs) Handles
> MyBase.HelpRequested
>
>      Dim strHelpDocumentPath As String
>
>      'determine whether a Help file exists
>
>      strHelpDocumentPath = gstrHelpPath & Me.Name & ".doc"
>
>      If File.Exists(strHelpDocumentPath) Then
>
>         'launch Word
>
>         Process.Start("WinWord.exe", strHelpDocumentPath)
>
>         'Process.Start("WinWord.exe", "C:\Projects\Human
> Services\Documents\Help\frmAppointmentWorker.doc") 'the string in
> strHelpDocumentPath
>
>      Else
>
>         MessageBox.Show("A Help document for " & Me.Name & " does not yet
> exist.", "Help document not found", MessageBoxButtons.OK,
> MessageBoxIcon.Information)
>
>      End If
>
>      hlpevent.Handled = True
>
>   End Sub
>
>
>
> Thanks in advance,
>
> Dean Slindee
>
>
>
Author
30 Mar 2005 1:23 PM
Herfried K. Wagner [MVP]
"Dean Slindee" <slin***@charter.net> schrieb:
> [...]

Please stay in the original thread...

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>