Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE Automation Error using Excel 2000 and VB6

Status
Not open for further replies.

DreewToo

Programmer
Dec 20, 1999
128
US
I wanted to record this tip for histories sake. It's an issue I struggled with for years, but finally happened upon a discussion between Paul Mazaika and Dan Jinks occurring late September, 2001, at Codehound.com, which answered the issue I'd been experiencing all along.

Basically, I'm creating excel workbooks using VB and early binding, and on specific workbooks, when I go to close and set all objects to nothing, a hidden instance of Excel remained in memory, regardless of the API or getobject code I tried to close the instance. This would make it so VB could not create an instance of a new excel object, and force me to restart the application at each point it would mess up. I'm still not sure why it messed up.

The solution the two guys mentioned above arrived at, and that I'd like to share here, is to early bind the excel.application and excel.workbook object variables, but late bind the worksheet variable. Why this is effective is a question for those more experienced than myself, but it's working to correct the issue I was having, and now I can find myself another issue to chew on...

I hope this helps someone out there,

Drew Bell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top