|
-
Apr 14th, 2001, 04:38 AM
#1
Hi there - I am trying to copy recordsets from Access dbs to Excel (using DAO), then save the workbook and close Excel.
I had problems repeating the copyfromrecordset command, so it's all got a bit messy now. It now works, but I can't get Excel to quit...
Workbooks.Add
Application.Visible = False
For intCount = 0 To Data2.Recordset.Fields.Count - 1
Cells(1, intCount + 1).Value = Data2.Recordset.Fields(intCount).Name
Next
Range("A2").CopyFromRecordset Data2.Recordset
Set objExcel = GetObject(, "Excel.application")
objExcel.Cells(1, 1).CurrentRegion.EntireColumn.AutoFit
objExcel.Sheets("Sheet1").Name = strReportName
objExcel.ActiveWorkbook.SaveAs FileName:= _
"C:\Windows\Temp\"
objExcel.Quit
Set objExcel = Nothing
As soon as I stop the VB ap, Excel disappears from the active task list.
I'd appreciate some help before I throw my PC out the window
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|