on 09-30-2008 4:40 AM
Hi Friends,
I need to open an excel file from Business partner form for that i created a button on that button click put the code .
My code for creating excel is ,
FileStream fs = new FileStream(sPath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
sPath is the file path.
I called the excel file using
ProcessStartInfo startInfo = new ProcessStartInfo(sPath);
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(startInfo);
It shows the message as "unable to read file". Please help me to solve this problem.
Nisha.
Hi
If you need only to open file, your code is good.
Are you shure what file exist?
Make the brackpoint and see the sPath and try to open the file from command prompt.
Regards
Sierdna S.
P.S. VB code.
Private Sub LoadExcelFile(ByVal sXlsFile As String)
Try
Dim startInfo As New ProcessStartInfo(sXlsFile)
startInfo.WindowStyle = ProcessWindowStyle.Maximized
Process.Start(startInfo)
Catch ex As Exception
' log exception
Finally
System.GC.Collect() 'Release the handle to the table
End Try
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
i am using 2003 excel
Nisha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Billa 2007,
I tried the code
Dim sPath As String = CurDir()
Dim xlApp As Excel.Application = New Excel.Application
xlApp.Workbooks.Open(sPath & "\" & "XXXXX.xls")
having error
"The type or namespace name 'Excel' could not be found (are you missing a using directive or an assembly reference?)"
Nisha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi...
Try this code..
Dim sPath As String = CurDir()
Dim xlApp As Excel.Application = New Excel.Application
xlApp.Workbooks.Open(sPath & "\" & "XXXXX.xls")
Regards..
Billa 2007
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.