[AccessD] Problem with Access VBA makes Excel Orphan

Edward Zuris edzedz at comcast.net
Fri Nov 13 17:38:25 CST 2009


 Yesterday, I looked
 at -> http://support.microsoft.com/kb/319832

 But it was unclear what they were talking about.

 I use "Option Explicit".

 I didn't understand the precede part.

 What is scary is when I was a brown badge
 at MSFT, I worked with some of the folks
 who wrote some of the KB stuff.


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart
McLachlan
Sent: Friday, November 13, 2009 3:29 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Problem with Access VBA makes Excel Orphan


Third time I've answered this on the list this year. 

See:
TrasnferSpreadsheet failing  on 18 March 2009
and 
Access to Excel Automation works first time on 13 July 2009:
in the archives.

The old "unqualified reference" strikes again :-)
See http://support.microsoft.com/kb/319832

 <quote> When you write code to use an Excel object,
         method, or property, you should always precede
         the call with the appropriate object variable.
         If you do not, Visual Basic establishes its
         own reference to Excel. </quote>
-- 
Stuart

On 13 Nov 2009 at 12:58, Edward Zuris wrote:

> 
>  Using the below code from an Access 2000 VBA
>  application, once running these commands there
>  is still an Excel job running in task manager.
>  
>  The Excel orphan makes it impossible to run the
>  VBA application recessively.
>  
>  One clue is Excel will finally shut down if
>  the Access 2000 VBA application / database
>  is shutdown.
>  
>  Any way to tell Excel to just shut down ?
>  
>  Is there a work-a-round for this problem ?
>  
>  Thanks.
>  
>  Sincerely,
>  Edward Zuris.
> 
>  -
>  
>  =======================================================
>  ====== .Quit code not closing Excel Application ======
>  
>     Dim ExcelApp            As Excel.Application
>     Dim ExcelwBook          As Excel.Workbook
>     . . .
>     Set ExcelApp = New Excel.Application
>     Set ExcelwBook = ExcelApp.Workbooks.Add
>     . . .
>     ExcelApp.DisplayAlerts = False
>     ExcelwBook.SaveAs zPath & zName
>     ExcelApp.DisplayAlerts = True
>  
>     ExcelwBook.Save
>     ExcelwBook.Close False
>     ExcelApp.Quit
>  
>     Set ExcelwBook = Nothing
>     Set ExcelApp = Nothing
>  
>  =======================================================
>  =======================================================
>  -
>  
>  Yet a simpler VBA applications doesn't have
>  this issue using the following.
>  
>  This also fails using the complex VBA program.
>  
>  Any ideas ?
>  
>  =======================================================
>  = .Quit code Working closing simple Excel Application =
>  
>     ExcelwBook.Application.DisplayAlerts = False
>     ExcelwBook.SaveAs zPath & zName
>     ExcelwBook.Application.DisplayAlerts = True
>  
>     ExcelwBook.Application.Quit
>  
>     ExcelApp.Quit
>     
>     Set ExcelwBook = Nothing
>     Set ExcelApp = Nothing
>  
>  
>  =======================================================
>  =======================================================
>  
>  
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list