Hi Mike,
Getting an application's window handle does not directly help attach a
reference to the application. With the MS example you don't know which app
instance the handle relates to, but even if you do it doesn't help in
setting a ref to the app (
AFAIK). Having said that getting "all" app' window
handles is one of many steps in the process I use to grab all unknown
running instances, it's not straightforward.
For your particular purposes think I would stick with the GetObject method
that works for you. But I'll stand corrected.
Regards,
Peter T
"nmventure" wrote in message
...
I've also found this examle for visual basic that I've tried and it works
with vba in excel 2000.
http://support.microsoft.com/kb/258511/EN-US/
This one gets the windows handle which might be a more sure way of getting
the instance you want.
"nmventure" wrote in message
...
I have two questions about gaining control of an already-running
instances
of excel that was started from the Start/Programs menu, *NOT* from VBA
code.
1.
Does anyone know how to locate and close a workbook named "daily.xls"
that
is open in another already existing instance of Excel that was *NOT*
started
from VBA code, and thus does *NOT* have an object reference to use in
the
VBA code of the instance of Excel that I am working from ?
2.
Also, is it possible that after you have a way to reference the other
instance of Excel, that you can crate an object, and set it to the
already-open other instance of Excel to gain control of it for other
actions
besides just closing it?
I know how to dim a new excel application and set it with CreateObject,
but
that's *NOT* what I'm wanting to do here and just want to try to be
clear
on
what I'm looking for.
I know there must be a way to find the Windows handle and return a
workbook
name but I haven't been able to figure it out yet....Thanks in
advance...Mike