ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hanging Instances Of EXCEL.EXE? (https://www.excelbanter.com/excel-programming/303667-hanging-instances-excel-exe.html)

MDW

Hanging Instances Of EXCEL.EXE?
 
Hey all,

I'm working with Excel from within Access using automation. I'm running a comparison between two tables, and checking for differences. The results will be displayed in an Excel sheet.

I know that when you're working with Excel, you should kill all instances of it (objXL.Quit, etc.) However, if certain criteria are met, I want to display the newly-created workbook on the screen....users could use the "Save As" option and do with it what they like - I have no interest in it after that. If I do that, would I still need to kill Excel, or would their closing the program handle that? Here's a skeleton of the code. objXL and objWB have module-level scope.

' Assume no differences
blnDifferences = False

' Create a handle to Excel
Set objXL = CreateObject("Excel.Application")

' We'll start a workbook with 0 sheets - we'll add sheets as needed
objXL.SheetsInNewWorkbook = 0
Set objWB = objXL.Workbooks.Add
objXL.SheetsInNewWorkbook = 3

' SUBS GO HERE - TO RUN CHECKS

If blnDifferences Then

objXL.Visible = True
' ?? Anything else here?

Else

MsgBox "No differences have been found.", vbInformation, "Check OK"

objWB.Close
Set objWB = Nothing

objXL.Quit
Set objXL = Nothing

End If

Calligra[_2_]

Hanging Instances Of EXCEL.EXE?
 
Their closing of the Excel Workbook will do that.



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 09:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com