Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / June 2006

Tip: Looking for answers? Try searching our database.

Excel Object Variable not released

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben - 02 Jun 2006 16:52 GMT
Hi all,

I have Access 2002 sp3.  In my vba code, I delcared and set an object
variable to Excel.  I was able create the instance, have it open a workbook
and do a fews things through code.  However, when it was time to close and
save the workbook,  and close the instance of Excel and destroy the Excel
object variable, I was unable to.  My code looked like:

oExcel.ActiveWorkbook.close
oExcel.Application.Quit     'I tried to use oExcel.Quit, but both do not work.
Set oExcel = Nothing

After the last line, I checked the task manager and I still see the
instance.  I then opened another instance of Excel and tried to open the same
file that I had the first instance open.  But when I tried, Excel came back
saying the file is being used by me and gave me the option to open it as a
Read Only or Notify.
Does any one know why this is?  Thanks for sharing your thoughts.

Ben

Signature

 

Klatuu - 02 Jun 2006 18:31 GMT
This is most commonly caused by incomplete or incorrect object referencing.  
You should always be sure when you are creating a reference to object in the
Excel object model, that you reference completely from the application level
down.  What happens if the reference is ambiguous is that Access doesn't know
what higher level object it belongs to, so it creates an additional
application level reference for it.  So when you issue the Quit command, it
quits one, but leaves the other open.  Review your code to be sure your
references are fully qualified.

> Hi all,
>
[quoted text clipped - 16 lines]
>
> Ben
strive4peace - 02 Jun 2006 18:31 GMT
Hi Ben,

do you have any other object references -- like to a
workbook or a sheet?  Can you post the complete code you are
using?

Warm Regards,
Crystal
Microsoft Access MVP 2006

 *
       Have an awesome day ;)

  remote programming and training
  strive4peace2006 at yahoo.com

 *

> Hi all,
>
[quoted text clipped - 16 lines]
>
> Ben
Ben - 02 Jun 2006 19:58 GMT
Signature

 

> Hi all,
>
[quoted text clipped - 16 lines]
>
> Ben
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.