View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.programming
HeatherO HeatherO is offline
external usenet poster
 
Posts: 41
Default Late Binding issues when closing workbooks

I am using office XP. I will step through my code to make sure. I am
curious though you said you have to release the references the same way you
assign them? Do you mean that when I assign the first workbook I should close
that workbook last? Is there anyway to test to see if the workbook.close
command doesn't work or if there is an error on it? I really appreciate you
checking through all the code, as it was alot of code. Thanks for all your
help, I'll keep trying. This late binding is trully difficult.
Thanks again for your time,
Heather

"Tom Ogilvy" wrote:

It tested the order of releasing references on xl97 and it didn't seem to
cause the problem so I guess that is OK. Have you taken an inventory to
insure every reference you create is set to nothing at the end?

I did see
AppXL.Quit

but it would take a bit of effort to insure all references were released.

I agree with Dick that you should terminate the On Error Resume Next as soon
as possible.

Also, if you are using late binding as you appear to be doing,

On Error Resume Next
Set AppXL = CreateObject("Excel.application")
On Error goto 0

If Err Then
xlntrn = True
' this next line would start a new instance of Word wouldn't it?
' also even if you said New Excel.Application, that wouldn't
' work with late binding.
Set AppXL = New Application
End If

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
What version of Office are you using?

I did go through your code earlier today and and nothing obvious

appeared -
I was concerned that you released your references opposite from the way

they
would be assigned, but I tested that concept in simpler code in Word 2003
and it didn't cause a problem, but perhaps they have made Office 2003 more
robust with respect to this. Thus I was wondering what version of office

you
are using?

--
Regards,
Tom Ogilvy

"HeatherO" wrote in message
...
Hi Tom,
I have posted the code above for Dick. It's alot of code though to go
through. Anyways I understand you were illustrating a point. I have

however
stepped through the code and it all goes well the first time everything

runs
smoothly. When I go to run it again the files are locked or empty, and

it
looks when I go to my task manager after running it the first time like

it
didn't shut down the application. When I stepped through it though it

did
step into the AppXL.quit command but it isn't shutting down the excel
application. Could there be a reason why the AppXL.quit command would

not
work in shutting down the application?? This is why my workbooks remain
locked with the ghost references.
Thanks again for everyone's help.
Heather

"Tom Ogilvy" wrote:

I was trying to illustrate a concept. If you have an example that

actually
causes the problem, post away.

--
Regards,
Tom Ogilvy

"Bob Phillips" wrote in message
...

"Tom Ogilvy" wrote in message
...
Since Word has a range object, let's adjust it to

But it doesn't have a Range(cell) object, so it bombs as you wrote

it.