[AccessD] Problem with Access VBA makes Excel Orphan

Stuart McLachlan stuart at lexacorp.com.pg
Fri Nov 13 16:29:20 CST 2009


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





More information about the AccessD mailing list