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

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