By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,230 Members | 2,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,230 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 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?

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")

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+
3 Replies


P: n/a
For starters you have a space between 'Human' and 'Services'. I'm certain
that you will have to quote the string to make it work.

If that is, in fact the case, then winword can't find the file. If you think
that the error message is inappropriate then take it up with a winword
group. It is winword throwing the message, not your application.
"Dean Slindee" <sl*****@charter.net> wrote in message
news:w7*****************@fe02.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 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?

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")

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
"Stephany Young" <noone@localhost> wrote in
news:#b**************@tk2msftngp13.phx.gbl:
For starters you have a space between 'Human' and 'Services'. I'm
certain that you will have to quote the string to make it work.

If that is, in fact the case, then winword can't find the file. If you
think that the error message is inappropriate then take it up with a
winword group. It is winword throwing the message, not your
application.
"Dean Slindee" <sl*****@charter.net> wrote in message
news:w7*****************@fe02.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 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?

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")

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



Process.Start("WinWord.exe", strHelpDocumentPath)
I think it's ths line, have a look here:

http://msdn.microsoft.com/library/de...l=/library/en-
us/cpref/html/frlrfsystemdiagnosticsprocessclassstarttopic.asp

It should be Process.Start(strHelpDocumentPath)
The file extention is used to determin what app opens it as stated here:

Starting a process by specifying its file name is similar to typing the
information in the Run dialog box of the Windows Start menu. Therefore,
the file name does not need to represent an executable file. It can be
of any file type for which the extension has been associated with an
application installed on the system. For example the file name can have
a .txt extenstion if you have associated text files with an editor, such
as Notepad, or it can have a .doc if you have associated .doc files with
a word processing tool, such as Microsoft Word.

http://msdn.microsoft.com/library/de...l=/library/en-
us/cpref/html/frlrfsystemdiagnosticsprocessclassstarttopic3.asp

Nov 21 '05 #3

P: n/a
Dean,

A sample with notepad, however in my opinion exactly the same as your
question.
\\\Notepad
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.arguments = "c:\windows\win.ini"
pi.FileName = "notepad.exe"
p.startinfo = pi
p.Start()
///

I hope this helps,

Cor
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.