I'm creating an array P & want to dump it's elements into an Excel worksheet :
VB Code:
Set oXLApp = New Excel.Application Set oXLBook = oXLApp.Workbooks.Add Set oXLSheet = oXLBook.Worksheets(1) While param < Val(Text3.Text) param = Val(Text2.Text) + Val(Text4.Text) * m ... oXLSheet.Cells(m + 1, 1).Value = param ... m = m+ 1 Wend ... End Sub
I get a 'object variable or with block variable not set' error on statement :
oXLSheet.Cells(m + 1, 1).Value = param
Why?
I thought I created the oXLSheet object in the statement before the While loop : Set oXLSheet = oXLBook.Worksheets(1)
Does this not carry over into a loop ?!




Reply With Quote