LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Late Binding issues when closing workbooks

Go into the task manager. There are probably many instances of Excel still
running. You code is probably not releasing Excel because it has created
ghost references which can't be released or you just plain old haven't put
in the code to release the references. (setting variables to nothing in
reverse order to the way they were created and quiting the Excel
application.)

This can be subtle.

xlApp.ActiveSheet.Range("A1").Sort Key1:=Range("A1")

would create a ghost reference because the Range("A1") is not qualified all
the way back to a releasable reference

xlApp.Activesheet.Range("A1").Sort Key1:=xlApp.Activesheet.Range("A1")

would be the fix.

--
Regards,
Tom Ogilvy

"HeatherO" wrote in message
...
I have used late binding to access excel workbooks from my word macro.

The
problem I appear to be having is that when I run the macro the first time

it
runs smoothly. However if I run it again some of my files (ones for the

mail
merge) are locked and won't open when I am trying to open them in the

macro.
I do have it in my code to close those workbooks and quit the application.
Is there any way to test for the workbook.open command failing when it
doesn't open a workbook for this reason?
Is there a way of opening a workbook so that you would not get the

locked
for editing by another user and notification of when it's available

message?
Also when the macro bombs all the files and application are left open
causing errors when I am trying to debug it again, is there any quick fix

to
clean up the files and close the application if the macro bombs before it

has
a chance to do those things?
Any help is appreciated.
Thanks,
Heather



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Late Binding examples of binding excel application HeatherO Excel Programming 13 March 17th 05 08:19 AM
Late Binding help, Please Bud Dean Excel Programming 5 September 24th 04 04:31 AM
Late Binding Todd Huttenstine[_3_] Excel Programming 3 April 30th 04 11:01 AM
EARLY binding or LATE binding ? jason Excel Programming 6 February 26th 04 04:57 PM
DAO Late Binding? Sharqua Excel Programming 2 January 4th 04 02:05 AM


All times are GMT +1. The time now is 04:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"