Okay, I'm not opening a spreadsheet from a
spreadsheet. I'm looking for the path before the
spreadsheet actually opens. I might be using the
wrong method. I've got code placed within the
ThisWorkbook.Open method...
Workbook_Open() method
I've got the code placed there...
sPath = ThisWorkbook.Path
ThisWorkbook.Path returns a variety of information
that is related to other workbooks (spreadsheets) that
are opened up within Excel, information that is set by
the variable (which I think is read from the registry)
File, Options..., General tab, Default file location:
I'm opening the spreadsheet by double-clicking on it from
Windows Explorer. If another spreadsheet is open inside of
Excel, ThisWorkbook.Path returns the path to the spread-
sheet that is already open. I want the path to the spreadsheet
that isn't open yet. The spreadsheet that is opening up and
I'm wanting to obtain this path inside of the Workbook_Open()
method.
Hope that explains what's happening a little better. I'm writing
code that will be used within Excel 2000 and Excel XP spread-
sheets.
--
Jim Carlock
http://www.microcosmotalk.com
Feel free to post back to the newsgroup!
"Tom Ogilvy" wrote in message
...
Workbooks.open "C:\Myfolder\Myfiles.xls"
sPath = ActiveWorkbook.Path
sPath would then equal "C:\MyFolder"
or
Dim bk as Workbook, sPath as String
set bk = Workbooks.Open("C:\Myfolder\Myfiles.xls")
sPath = bk.Path
--
Regards,
Tom Ogilvy
Jim Carlock <anon@localhost wrote in message
...
I've tried to use a number of items to get the proper path
to the Excel spreadsheet that is opening but I keep missing.
Sometimes the Excel spreadsheet takes it's own path from
a previously opened spreadsheet. Sometimes it takes it
from a parameter at:
Tools, Options..., General tab, Default File Location:
Specifically I am using VBA and trying to use:
ThisWorkbook.Path but that is giving the results above.
I need the correct path for the workbook / spreadsheet
file that is opening up. How do I get that path?
Thank you very much in advance. :-)
--
Jim Carlock
http://www.microcosmotalk.com
Feel free to post back to the newsgroup!