|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
problem opening Excel file with Shellnot found error, even though the file is really there. Yes, I checked to see if the path is correct, and yes, I have Excel installed. Any ideas what's going on? If I can't use Shell to get Excel to open a file, what do I use? TIA, Paul Public Overrides Sub Edit() Try If Not String.IsNullOrEmpty(FileName) Then Shell(FileName, AppWinStyle.NormalFocus) Catch ex As Exception Dim msg As String = "Error attempting to edit " & Me.FileName & ":" & vbCrLf & ex.Message MsgBox(msg, MsgBoxStyle.Exclamation, "function data editor") End Try End Sub PJ6,
Use process start instead of shell, much easier to use. \\\ Dim p As New System.Diagnostics.ProcessStartInfo() p.WindowStyle = ProcessWindowStyle.Hidden p.FileName = "C:\filename.xls" p.UseShellExecute = True System.Diagnostics.Process.Start(p) /// Cor Show quoteHide quote "PJ6" <nob***@nowhere.net> schreef in bericht news:%238K$2SHbGHA.3408@TK2MSFTNGP04.phx.gbl... > This little snippet works for .txt files, but for any .xls file I get a > file not found error, even though the file is really there. > > Yes, I checked to see if the path is correct, and yes, I have Excel > installed. > > Any ideas what's going on? If I can't use Shell to get Excel to open a > file, what do I use? > > TIA, > Paul > > Public Overrides Sub Edit() > Try > If Not String.IsNullOrEmpty(FileName) Then Shell(FileName, > AppWinStyle.NormalFocus) > Catch ex As Exception > Dim msg As String = "Error attempting to edit " & Me.FileName & ":" > & vbCrLf & ex.Message > MsgBox(msg, MsgBoxStyle.Exclamation, "function data editor") > End Try > End Sub > Thanks, thank worked.
Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%23wYXJAIbGHA.3408@TK2MSFTNGP04.phx.gbl... > PJ6, > > Use process start instead of shell, much easier to use. > \\\ > Dim p As New System.Diagnostics.ProcessStartInfo() > p.WindowStyle = ProcessWindowStyle.Hidden > p.FileName = "C:\filename.xls" > p.UseShellExecute = True > System.Diagnostics.Process.Start(p) > /// > Cor > > "PJ6" <nob***@nowhere.net> schreef in bericht > news:%238K$2SHbGHA.3408@TK2MSFTNGP04.phx.gbl... >> This little snippet works for .txt files, but for any .xls file I get a >> file not found error, even though the file is really there. >> >> Yes, I checked to see if the path is correct, and yes, I have Excel >> installed. >> >> Any ideas what's going on? If I can't use Shell to get Excel to open a >> file, what do I use? >> >> TIA, >> Paul >> >> Public Overrides Sub Edit() >> Try >> If Not String.IsNullOrEmpty(FileName) Then Shell(FileName, >> AppWinStyle.NormalFocus) >> Catch ex As Exception >> Dim msg As String = "Error attempting to edit " & Me.FileName & >> ":" & vbCrLf & ex.Message >> MsgBox(msg, MsgBoxStyle.Exclamation, "function data editor") >> End Try >> End Sub >> > >
Loading controls with objects versus recordsets
DataTable Loop and String Building TAG Property Is there an easy way to get my Subnet Mask? VB 2005 express database problems Ent Library. Substitute data from app.config? DATAGRID PROBLEM MailMessage to send email with both Text and HTML versions... vb.Script to VB.NET 2005 Displaying copied file names in textbox |
|||||||||||||||||||||||