Hi All,
I’m attempting to work with Excel from Access. For the most part, it’s going smoothly. But that is as long as I give control of Excel to the user at the end:
Dim xlApp As New Excel.Application
Dim xlsheet As New Excel.Worksheet
xlApp.Workbooks.Open strExternalFile
Set xlsheet = xlApp.Worksheets(“Access Data”)
‘Do stuff to play with the sheet
xlApp.Visible = True
Set xlsheet = Nothing
Set xlApp = Nothing
But I also want the option of doing stuff to multiple worksheets and not having them open at the end (or I’ll end up with multiple Excels open at the same time, which is just not good on our standard P233s with 64meg of RAM ;-).
I tried using this to close excel, but the first line generates an error:
‘ xlApp.Workbooks.Close
xlApp.Quit
The second line is fine, but I always get a prompt to save the file. Since there will be 12 workbooks created in this routine, I don’t want the user to deal with saving the file. xlApp.Workbooks.saveas does not exist at all.
Does anyone know how I can save and close the workbook and completely close Excel without having the user do anything?
Thanks,
Cecilia