Hi Rama
How do you get arrXL ??
That's the difficult bit. As I said, I briefly described my VBA method in
the thread I referred you to (message #6 in date view). It is clunky though,
especially the bit about DDE and adding a new workbook (unsaved BookX) if
necessary in instances with which to use GetObject to attach to it's parent
(ie the particular Excel instance).
If you are able to get the C# method working you're probably better to go
with that (I didn't get it working, probably down to me rather than the
method).
The point is there is no simple way to do what I think you are asking purely
to find the path of a file loaded in some Excel instance (surely some other
work around). If you have a very serious need and don't mind 'clunky' with a
LOT of VBA revert back.
Regards,
Peter T
"Rama" wrote in message
...
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