Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Robert Lie" wrote in message
oups.com... I run it from VB Form. Dim xla As Excel.Application Dim xlb As Excel.Workbook Dim xls As Excel.Worksheet Dim xlr As Excel.Range Actualy, the main problem is how to remove the excel application from Processes (Windows task manager) after the excel is closed? Hi Robert, As Tim has pointed out, your code is filled with unqualified references to Excel properties and methods. Whenever you run something like this from VB: Set xlr = Range(xls.Cells(1, 1), xls.Cells(1, 3)) You haven't told VB what object the Range method applies to so VBA creates a hidden instance of the default object for it. Then, when you try to close Excel you can't, because your VB application still has all of these hidden references to Excel that you have no way to get rid of. In the case above, all you need to do to correct the problem is this: Set xlr = xls.Range(xls.Cells(1, 1), xls.Cells(1, 3)) This makes every Excel method in that line of code fully qualified and therefore doesn't create any additional references to Excel. You need to do the same thing for all the rest of your code. Every reference to every Excel object, property and method in your program must derive in an unbroken sequence from your original Excel Application object variable. Once you do this you will be able to destroy all the Excel references your program creates and shut Excel down cleanly. -- Rob Bovey, Excel MVP Application Professionals http://www.appspro.com/ * Take your Excel development skills to the next level. * Professional Excel Development http://www.appspro.com/Books/Books.htm |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Colon at the end of excel file name(ex: problem.xls:1, problem.xls | New Users to Excel | |||
Problem viewing Excel 2003 Pivot Chart fields in Excel 2007 | Charts and Charting in Excel | |||
Weird problem with Excel 2000...Worksheets disappearing in a shared Excel file | Excel Discussion (Misc queries) | |||
Started out as an Access problem. Now an Excel problem | Excel Discussion (Misc queries) | |||
EXCEL FORMAT PROBLEM WHEN SENDING EXCEL SHEET AS MESSAGE BODY IN . | Excel Discussion (Misc queries) |