I am using Access 97.
I am trying to populate an Excel spreadsheet when I get a run-time
error 1004. The error says :
Method 'Sheets' of object '_Global' failed.
What I am trying to do is populate several different tabs with data.
For whatever reason, OLE Automation seems to get "lost".
The code looks something like this.
Set ws = wb.Sheets("Fees ")
lnRowCount = 1
Do While not rsBalanceReport .EOF
lnRowCount = lnRowCount + 1
lcCellA = "A" & trim(str(lnRowC ount))
lcCellB = "B" & trim(str(lnrowc ount))
ws.range(lcCell A).value = rsBalanceReport (0)
ws.range(lcCell B).value = rsBalanceReport (1)
rsBalanceReport .MoveNext
loop
*Code Crashes on the next line.
Sheets("Rebate Buckets").Selec t
Columns("A:Z"). AutoFit
Columns("A:Z"). Select
Selection.Numbe rFormat = "#,##0.00"
How can I fix this problem.
I am trying to populate an Excel spreadsheet when I get a run-time
error 1004. The error says :
Method 'Sheets' of object '_Global' failed.
What I am trying to do is populate several different tabs with data.
For whatever reason, OLE Automation seems to get "lost".
The code looks something like this.
Set ws = wb.Sheets("Fees ")
lnRowCount = 1
Do While not rsBalanceReport .EOF
lnRowCount = lnRowCount + 1
lcCellA = "A" & trim(str(lnRowC ount))
lcCellB = "B" & trim(str(lnrowc ount))
ws.range(lcCell A).value = rsBalanceReport (0)
ws.range(lcCell B).value = rsBalanceReport (1)
rsBalanceReport .MoveNext
loop
*Code Crashes on the next line.
Sheets("Rebate Buckets").Selec t
Columns("A:Z"). AutoFit
Columns("A:Z"). Select
Selection.Numbe rFormat = "#,##0.00"
How can I fix this problem.
Comment