I used to work with VB6 and I referenced MSExcel 11.0 Library Object (MSoffice 2003). Now with MSOffice 2007, I am only given one choice of referenced MSExcel 12.0 Library Object
here is the code:
The error is "Application-defined or Object-defined error"Code:' in form Option Explicit Public xlApp As Excel.Application Public xlWB As Excel.Workbook Public xlWS As Excel.Worksheet ' in routine where I want to write to MS Excel 2007 Private Sub StepCurrentCmd_Click() Dim DisplayStr As String Dim row As Integer Dim col As Integer Set xlApp = New Excel.Application Set xlWB = xlApp.Workbooks.Add Set xlWS = xlWB.Worksheets("sheet1") row = 2 col = 1 xlWS.Cells(row, col).value = DisplayStr ' DisplayStr is an updated string col = col + 1 End Sub
Essentially the error is at the line:
xlWS.Cells(row, col).value = DisplayStr
I noticed that the letter v in value (above) refuses to be capitalized. In the older application where I was using 11.0 library, the v in value automatically became capitalized. Is this the issue?
thanks.




Reply With Quote