[AccessD] More Access to Excel Help Needed - Solved

Dan Waters dwaters at usinternet.com
Thu Sep 20 14:15:38 CDT 2007


Thanks Tom!

I always like hearing how things worked out.

Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of ewaldt at gdls.com
Sent: Thursday, September 20, 2007 1:36 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] More Access to Excel Help Needed - Solved

Thank you all for your help. I finally found the solution to the problem. 
Of all places, it was actually at Microsoft.com!

The KnowledgeBase article #319832, on page 4 of 5 (when you print it out, 
of course) has a section entitled, "Qualifying the Code to Avoid Errors." 
In speaking of automation errors, it mentions a reference to 
"Workbooks.Count" in its example code, without referencing the Excel app 
that had been created. The author states, "When you run the code, it 
appears to run correctly the first time. However, Excel continues to run, 
even though you called the Quit method." That is what was happening to me. 
Apparently, referencing global puppies (in the technical sense) can cause 
an app to hang. Simply qualifying the code more fully makes the 
difference. 

In my case, my Access code had the line,

        VBProject.VBComponents.Add(vbext_ct_StdModule)

This was in a separate module  (from Microsoft.com, btw), which my main 
module called. To avoid confusion, I pulled all of the code from that 
separate module into my main one and added the reference to the Excel 
workbook variable I was using:

        xlBook.VBProject.VBComponents.Add(vbext_ct_StdModule)

I also changed some early binding to late binding at the article's 
suggestion. That might not have helped, since I made that change before I 
made the one above, and it still didn't work. I've left it in, though, for 
insurance. ;-)

Anyway, it now works. When I close Excel within this code it closes 
correctly.

Thanks, again, for everyone's help. I thought this lesson was worth 
passing on. It's always good to qualify. ;-)

Thomas F. Ewald
Stryker Mass Properties
General Dynamics Land Systems




This is an e-mail from General Dynamics Land Systems. It is for the intended
recipient only and may contain confidential and privileged information.  No
one else may read, print, store, copy, forward or act in reliance on it or
its attachments.  If you are not the intended recipient, please return this
message to the sender and delete the message and any attachments from your
computer. Your cooperation is appreciated.

-- 
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