hi people,
I have made following code but I can't open the file why?
see code below:
No code erros but it says: Couldn't find the file C:\xxx\xxx.test.xlsx is the file moved? renamed or deletedCode:Imports excel = Microsoft.Office.Interop.Excel Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim dlg As New OpenFileDialog dlg.Filter = " Excel-Arbetsbok(*.xlsx)|*.xlsx|Excel 97-2003-arbetsbok (*.xls)|*.xls)" dlg.ShowDialog() Dim FPath As String = IO.Path.GetDirectoryName(dlg.FileName) Dim XlApp As New Microsoft.Office.Interop.Excel.Application() Dim wb As Microsoft.Office.Interop.Excel.Workbook = XlApp.Workbooks.Open(FPath & dlg.FileName.ToString()) XlApp.Visible = True End Sub




Reply With Quote
