Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have code in an Access module that opens an Excel file using CreateObject.
I have a lot of code in the Excel file and the user's only interaction in Excel is via five buttons I offer, one of which is a "Save & Close" button. Everything works fine EXCEPT Excel does not close when "Save & Close" is clicked. The workbook closes, but Excel does not. Below is my code in the Excel module that I use to save the workbook and close it, then quit Excel, but the "Application.Quit" statement is skipped (I used a break to watch what happens). It all closes fine when I open the file on my own (double clicking the xls file), but when I open it via the Access function I created, only the workbook closes, not the Excel application. I do not have a "Quit" statement in the Access function I created because the user needs to interact and use Excel, so I can't use Access to close Excel right after it opens it. I guess it's not a crime if Excel is left running after the user modifies the workbook, but I would like to close Excel completely if possible. Sub CloseWorkBook() On Error Resume Next Application.Caption = "Microsoft Excel" Application.WindowState = xlMaximized RestoreToolbars AppActivate "Microsoft Access" Sheets("Sheet1").Select ThisWorkbook.Close (True) Application.Quit End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel program remains open after closing file | Excel Discussion (Misc queries) | |||
Use CreateObject to add a new module to Excel | Excel Programming | |||
Prevent open excel windows from automatically closing. | Excel Discussion (Misc queries) | |||
Excel CreateObject on server | Excel Programming | |||
How do I stop Excel from closing the open file each time I open a. | Setting up and Configuration of Excel |