Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel quit opening | Excel Discussion (Misc queries) | |||
quit ie from excel macro | Excel Discussion (Misc queries) | |||
can't quit excel | Excel Discussion (Misc queries) | |||
Excel won't quit | Excel Discussion (Misc queries) | |||
Excel won't quit | Excel Programming |