View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Maintain integrity of Excel instances

j = 2
for i over each value of 1 to 3
row(i).copy to Sheet2 in row j
j++
Next i

that is what I mean by pseudo code - describing the concept, but not taking
the time to write the actual code that would executable.

You are correct that these workbooks are being opened in the same instance
of excel.

--
regards,
Tom Ogilvy


"XP" wrote:

Hi Tom,

Okay, then I think maybe I was confused by opening other files in the
"coded" instance, then when it closed it of course closed all open files in
that instance, but I was thinking the secondary files were opened in a
separate instance.

But for clarity, what do you mean by pseudo code? - like running VBA from a
VBScript or bat file?

Thanks for reply and clarifying...

"Tom Ogilvy" wrote:

Unless you are showing pseudo code, the code you show would only run in and
affect a single instance of excel and that is the instance where the code is
running.

--
Regards,
Tom Ogilvy



"XP" wrote:

Using Office 2003 and Windows XP;

This seems odd to me, but it seems that sometimes Application.Quit will shut
down a second running instance of Excel. I haven't thoroughly tested when
this occurs.
Am I just mistaken and/or confused having more than one instance running or
is this by design based on which instance happens to be active when the code
runs?

Is there a way to ensure the desired effect by returning a reference to the
current instance and quit only that one? Is it possible to use something like:

ThisWorkbook.Application.Quit

Could someone please help me out with some example code and discussion on
this?

Thanks much in advance for your assistance.