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(lnRowCount))
lcCellB = "B" & trim(str(lnrowcount))
ws.range(lcCellA).value = rsBalanceReport(0)
ws.range(lcCellB).value = rsBalanceReport(1)
rsBalanceReport.MoveNext
loop
*Code Crashes on the next line.
Sheets("Rebate Buckets").Select
Columns("A:Z").AutoFit
Columns("A:Z").Select
Selection.NumberFormat = "#,##0.00"
How can I fix this problem.