[AccessD] Let Excel object live?

Hale, Jim Jim.Hale at FleetPride.com
Fri Feb 2 11:47:08 CST 2007


Even making it visible often won't kill it (you click close but it remains
in the task manager). You have to be careful about destroying ALL object
variables or Excel will probably stick around.
Jim Hale

-----Original Message-----
From: sgoodhall at comcast.net [mailto:sgoodhall at comcast.net]
Sent: Friday, February 02, 2007 7:39 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Let Excel object live?


As much as I hate globals, I think this might be a valid use.  You could
make the Excel Application a global in another module, and it would stay
open until you destroy it.  You will need to ensure that it gets destroyed
before the application terminates, or you may end up with a zombie task.  If
your user kills the application with the Windows control box, you may not be
able to intercept it. Unless you make it visible, it will be hard to get rid
of.

Regards,

Steve Goodhall

 -------------- Original message ----------------------
From: Sad Der <accessd666 at yahoo.com>
> Hi group,
> 
> I've got a form that opens an Excel template and fills
> it with data.
> 
> I've got the following line:
> Private objXL As cExcel
> 
> this is a 'form level variabel'.
> When the user presses the 'export button' this line is
> called (on click event):
> Set objXL = New cExcel
> In the initiate of this Class I call a function that
> checks if there is an Excel instance:
> If objExcel Is Nothing Then
>         Set ExcelObject =
> CreateObject("Excel.Application")
>     Else
>         'do nothing, object already alive
>     End If
> 
> So at this point I have a form. In the properties of
> the form there is an objXL.
> When I close the form:
> DoCmd.Close acForm, Me.Name, acSaveNo
> 
> The Excel object (objXL) is destroyed and thus the
> terminate event is triggered. This event closes/kills
> the object and Excel itself is closed.
> How can I keep this object alive and still close the
> form?
> 
> Maybe not closing the form but hiding it? But how do I
> hide the form and when opening the form first check if
> it's open?
> Regards,
> 
> Sander
> 
> 
>  
>
____________________________________________________________________________
____
> ____
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail beta.
> http://new.mail.yahoo.com
> -- 
> 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

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list