View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
nmventure nmventure is offline
external usenet poster
 
Posts: 5
Default Taking control of an existing instance of Excel

Hi Peter,

Thanks, that's *exactly* what I'm looking for......

I had tried using the full path with the Microsoft example but got nowhere,
however, your implementation using "Parent" instead of "Application", along
with the full path, works perfectly for me, every time so far so thank you
for sharing that, it is exactly what I was looking for, and (so far) it has
worked in every test......

Thanks everyone else for their suggestions too. I'm pretty new to
newsgroups in general, and this is my first post in this one and it's
definitely a resource I'll turn to more often and contribute to as I am
able.

Mike
(using office pro 2000)


"Peter T" <peter_t@discussions wrote in message
...
Hi Mike,

Using that method you need to include the full path, then it "usually"
works. Also to set the object directly to the application - use Parent. eg

On error resume next
set xlApp = GetObject(stringPath & "\" & "daily.xls").Parent

If not xlApp is nothing then

I use a similar method to hook into unknown instances with unknown
workbooks, but it's very convoluted!

Regards,
Peter T


"nmventure" wrote in message
...
Thanks for the suggestion Tom. The example Microsoft shows on this page

is
exactly what I want to do, and I thank you, but for some reason I am
getting an "automation error" when I try to take control of the instance

by
workbook name as Microsofts example shows to do.....

Set xlApp = GetObject("daily.xls").Application
or
Set xlApp = GetObject("daily").Application

both generate the message:
runtime error '-2147221020 (800401e4)'
automation error
invalid syntax

The Microsoft example, copy and pasted below directly from their page,

does
not use the .xls part of the workbook or file name:
"Set xlApp = GetObject("Book2").Application"

According to them, this should work with Excel 97 through 2003. Has

anyone
tried to do this with any success....
(I am using office pro 2000)

Thanks again for your assistance,

Mike




"Tom Ogilvy" wrote in message
...
http://support.microsoft.com/default...b;en-us;288902

claims you can attach to an instance of excel if you know a specific
document in that instance.

I haven't tested it, but maybe they are right. since you are looking

for
Daily.xls it might work for you. Let us know.

--
Regards,
Tom Ogilvy