|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Process.Start("Winword.exe") problemWord 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 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. Show quoteHide quote "Dean Slindee" <slin***@charter.net> wrote in message news:w7o2e.6286$wl3.3067@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 > >
Show quote
Hide quote
"Stephany Young" <noone@localhost> wrote in Process.Start("WinWord.exe", strHelpDocumentPath)news:#b9CqFNNFHA.3420@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" <slin***@charter.net> wrote in message > news:w7o2e.6286$wl3.3067@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 >> >> > > > I think it's ths line, have a look here: http://msdn.microsoft.com/library/default.asp?url=/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/default.asp?url=/library/en- us/cpref/html/frlrfsystemdiagnosticsprocessclassstarttopic3.asp 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
Why have a DBNull?
vb.net windows deployment Datagrid cell change event? Where to find event. OutOfMemory exception loading ZIP or JPEG compressed TIFs from file CSV Separator Outlook.Application is not defined. PIA installed and setup correctly. RowFilter and DataColumn Named as Number Error in implementing interface Property I'd like to get an event each time the cursor stops moving. Upgrading .NET Framework v1.0 to v1.1 |
|||||||||||||||||||||||