Hello,
I'm trying to figure out how to read and write to an excel spreadsheet. I found a prevoius post and had the following example to read an excel spreadsheet. Have found other examples also, which all have had the following statement (XXXX = NEW Excel.Application).
I have referenced com excel 11.0 object library and imported it. When I run these few lines (changing the path of course), I receive the following error, " 'New' cannot be used on an interface". Not sure at all what this means. But each example I've seen uses the XXXX as new excel.application.
So, two questions.
1) How do I get rid of the " 'New' cannot be used on an interface" error.
2) Can someone please give me an example of how to write to an excel spreadsheet without using .xml and without using a dataset. All I want to do is find the date in column A, and then write three more fields to the corresponding row.
Thanks in advance,
Dim xlsApp As Excel.Application
Dim xlsWB As Excel.Workbook
Dim xlsSheet As Excel.Worksheet
Dim xlsCell As Excel.Range
Dim xlsDatei As String
xlsApp = New Excel.Application
xlsApp.Visible = True
xlsWB = xlsApp.Workbooks.Open(Path)
xlsSheet = xlsWB.Worksheets(1)
xlsCell = xlsSheet.Range("A1")
I'm trying to figure out how to read and write to an excel spreadsheet. I found a prevoius post and had the following example to read an excel spreadsheet. Have found other examples also, which all have had the following statement (XXXX = NEW Excel.Application).
I have referenced com excel 11.0 object library and imported it. When I run these few lines (changing the path of course), I receive the following error, " 'New' cannot be used on an interface". Not sure at all what this means. But each example I've seen uses the XXXX as new excel.application.
So, two questions.
1) How do I get rid of the " 'New' cannot be used on an interface" error.
2) Can someone please give me an example of how to write to an excel spreadsheet without using .xml and without using a dataset. All I want to do is find the date in column A, and then write three more fields to the corresponding row.
Thanks in advance,
Dim xlsApp As Excel.Application
Dim xlsWB As Excel.Workbook
Dim xlsSheet As Excel.Worksheet
Dim xlsCell As Excel.Range
Dim xlsDatei As String
xlsApp = New Excel.Application
xlsApp.Visible = True
xlsWB = xlsApp.Workbooks.Open(Path)
xlsSheet = xlsWB.Worksheets(1)
xlsCell = xlsSheet.Range("A1")