Hi
I need to Open an Excel File and am using the following code. I get no errors but nothing happens the File in question does not open. I have included a reference to Excel in my Project References.
If on the other hand I use the code below, the Excel File will open but only in Read Only Mode. I need to open the File in Normal view
Thanks ViRi
I need to Open an Excel File and am using the following code. I get no errors but nothing happens the File in question does not open. I have included a reference to Excel in my Project References.
VB.NET:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xlTemp As Excel.Application
xlTemp = New Excel.Application
xlTemp.Workbooks.Open("C:\Documents and Settings\TAP\Desktop\Post\Test.xls")
End Sub
End Class
If on the other hand I use the code below, the Excel File will open but only in Read Only Mode. I need to open the File in Normal view
VB.NET:
'Function
Private Sub CallProcess(ByVal path As String)
Dim p As New System.Diagnostics.Process
p.StartInfo.FileName = path
p.StartInfo.WindowStyle = ProcessWindowStyle.Minimized
p.Start()
'Wait until the process passes back an exit code
'p.WaitForExit()
'Free resources associated with this process
p.Close()
End Sub
'Call
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CallProcess("C:\testy.xls")
End Sub
Thanks ViRi