View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
rama rama is offline
external usenet poster
 
Posts: 13
Default find full file path of running excel instance

Hi,
Thanks to all. I found the suitable code in the following link. It gives
the full path names of all running excel(saved and non saved) instances.

http://www.mrexcel.com/board2/viewto...37277&start=10
--
Cheers,
Rama


"Rama" wrote:

Hi Peter,
Thanks for the reply. How do you get arrXL ??
I know the list of process using Process library in .NET but dont know what
you are referring to arrXL in the following message. Could you eloborate bit
futher? I tried to understand the ROT code posted in google forums but failed.
--
Cheers,
Rama


"Peter T" wrote:

It's not straightforward to find and reference multiple Excel instances.
If you understand C# (could use in your .Net) a method was described here -
http://tinyurl.com/yt36s5

In the same thread I briefly described my relatively though not 100%
reliable method to find and reference multiple Excel instances. Having done
so, for each referenced instance you could do something like this

On Error resume next
For i = 0 to UBound(arrXL) ' array of XL instances
set ws = arrXL(i).Workbooks("abc.xls")
if not ws is nothing then
sFile = ws.Fullname
Exit for

Regards,
Peter T



"Rama" wrote in message
...
Hi ,
Thanks for the reply but the trouble is I can get the instance full
path(bbc.xls) from Process library as illustarted in the following link so

I
dont know how to instantiate this excel running instance as I dont have

full
path.

http://forums.microsoft.com/MSDN/sho...06503&siteid=1



This following line works fine for unsaved excel instances

Set xlObj = VBA.GetObject("Book2").Application

but it fails to create reference whne it uses saved instance.

Set xlObj = VBA.GetObject("bbc").Application

it requires full path to access the currently running instance

Set xlObj = VBA.GetObject("c:\rama\bbc.xls").Application
--
Cheers,
Rama


"John Green" wrote:

ThisWorkbook.FullName

John Green

"Rama" wrote in message
...
Hi Experts,

Can anyone know how to findout the full path( ex:
c:\rama\bbc.xls) from the curently running instance "bbc.xls". I dont

mind
accepting VB6\.NET\Windows script solution for the same as i'm

desperate
to
find the full path from ruinng instance. Lets say I've opened saved
bbc.xls
file and i know the currently opened instances from Process library

and i
can
get the title("bbc.xls") but i dont know how to get the full
path("c:\rama\bbc.xls")

For more details please have a look at the following link.

http://forums.microsoft.com/MSDN/sho...06503&siteid=1


--
Cheers,
Rama