Hi,
i cant read in data from excel 97 using vb.net 2003.
I get an exception error .
all i want to do is read in values from excel initially. I want to just test it using msgbox.
i cant read in data from excel 97 using vb.net 2003.
I get an exception error .
all i want to do is read in values from excel initially. I want to just test it using msgbox.
Code:
Dim XL As Object 'workaround for excel 97
XL = Interaction.CreateObject("Excel.Application")
Dim XlWbk As Excel.Workbook = XL.Workbooks.Add()
Dim MyString As String
MyString = Now().ToString("yyyy-MM-dd")
Try
' XL.Visible = True
Dim XlSh As Excel.Worksheet = CType(XlWbk.Sheets(1), Excel.Worksheet)
Dim range As Excel.Range
Dim xlWsheet As Excel.Worksheet = XL.Worksheets("Sheet1")
Dim r As Excel.Range
XlWbk = XL.Workbooks.Open("mytest.xls")
XlWbk.Activate() '' System.Runtime.InteropServices.COMException,
range = XlSh.Range("A1").Value
XlWbk.Close()
XL.Quit()
MsgBox(r.Cells(0, 1).Value)
Comment