By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,190 Members | 1,412 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,190 IT Pros & Developers. It's quick & easy.

Process.Start("WinWord.exe") problem

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
"Dean Slindee" <sl*****@charter.net> wrote in message
news:J1*************@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

Nov 21 '05 #2

P: n/a
"Dean Slindee" <sl*****@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/>
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.