I am trying to get an existing Excel workbook from a file and working on it.
I need to specify a path to the file.
"GetObject" may not be compatible with "Open"
I did set the Reference to Microsoft Excel 14.0.
I need to specify a path to the file.
"GetObject" may not be compatible with "Open"
I did set the Reference to Microsoft Excel 14.0.
Code:
Dim xlApp As Microsoft.Office.Interop.Excel.Application
Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
xlApp = GetObject(, "Excel.Application")
xlBook = xlApp.open("C:\path\file.xls")
xlSheet = xlBook.Worksheets(1)
xlSheet.Activate()