I have what is likely a simple answer but I cant see it. I've simplified as much as possible to show the error. This is VBScript manipulating Excel. The below code works fine. The second code does not. It throws a vague 800A03EC Unknown runtime error on the line that works with data.
the error is on the line objExcel.Cells(intRow, intColumn).value = x Thanks in Advance
Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
intColumn = 2
for x = 0 to 20
objExcel.Cells(intRow, intColumn).value = x
objExcel.Cells(intRow, intColumn).Select
intRow = x + 1
intColumn = x + 1
next
Set objExcel = nothing
Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
intColumn = 2
for x = 0 to 20
strVal = "123R15"
intColumn = right(strVal,2)
objExcel.Cells(intRow, intColumn).value = x
objExcel.Cells(intRow, intColumn).Select
intRow = x + 1
intColumn = x + 1
next
Set objExcel = nothing