LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Can't get Excel to quit

Hi all,

I am using automation (From Access) to format a saved .xls
file. Even after all the research I have done on this
newsgroup, I still can't get Excel to quit through code.
I'm sure I must be missing something.

Below is what I'm doing in Code from Access:

*****Start*****
Dim appExcel As Excel.Application
Dim wkbWorkBook As Excel.Workbook
Dim wksWorkSheet As Excel.Worksheet

'Opens a saved report
Set wkbWorkBook = Excel.Application.Workbooks.Open
(strImpPath & txtClientName.Value & "_report.xls")

'Defines the worksheet
Set wksWorkSheet = Excel.Application.Worksheets("report")

'Run formatting code here

'Save, Close, Quit
wkbWorkBook.Save
wkbWorkBook.Close
*ATTEMPTING TO QUIT HERE*
Set appExcel = Nothing
Set wkbWorkBook = Nothing
Set wksWorkSheet = Nothing
*****End*****

If I use the variable - "appExcel.Quit", I get "RT-Err 91
ObjVar or With Block not set".

If I specify "Excel.Application.Quit", the procedure
completes successfully. However, Excel is still running
in the tsk mgr and if I try to view the report.xls I get
some kind of ghost window where I can see the Excel tool
bar (like the app is running) but no workbook.

If I comment out the ".Quit" line altogether: the
procedure completes successfully, Excel is still running
in tsk mgr, but this time I can open the report.xls and
see everything. However if I then close report.xls and
then try to open again immediately, I get the ghost Excel
window again. The only way to stop this is to exit my
Access app or quit Excel from the tsk mgr.

Any help with this would be greatly appreciated.

Thank you,

Todd Waldron
Austin, Tx.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel quit opening amber_verstraete Excel Discussion (Misc queries) 4 September 19th 07 06:44 PM
quit ie from excel macro Alfie Excel Discussion (Misc queries) 0 April 17th 07 11:52 PM
can't quit excel maven Excel Discussion (Misc queries) 0 March 15th 07 12:31 AM
Excel won't quit JRS Excel Discussion (Misc queries) 1 September 27th 05 04:31 AM
Excel won't quit Jeff[_23_] Excel Programming 0 October 24th 03 05:14 PM


All times are GMT +1. The time now is 08:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"