Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Obtain Path on open workbook

I need to obtain the path to a workbook when I open it and save it to
a named range "PathToForecastFile" in that workbook.

I have the code to obtain the filename of the current workbook:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",
CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

I need to send out templates to clients and I cannot guarrantee they
will or can put it in a predefined path.

Thanks,
Dennis

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Obtain Path on open workbook

=LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))-1)

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"ssGuru" wrote in message
oups.com...
I need to obtain the path to a workbook when I open it and save it to
a named range "PathToForecastFile" in that workbook.

I have the code to obtain the filename of the current workbook:
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",
CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

I need to send out templates to clients and I cannot guarrantee they
will or can put it in a predefined path.

Thanks,
Dennis



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Obtain Path on open workbook


=LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))-1)

That gives me a #NAME? error Bob
Thanks, Dennis

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Obtain Path on open workbook

Thanks, Bob,

My mistrake... I temporarily had the R1C1 set and that caused the
#Name error with the A1.

However =LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))-1)
results in a value of "C:\Data\SAP\[MT-ForecastRpt v2.070814.xls" and
I ONLY want the path and NOT the file name. This also results in a
path with an extra "[" bracket.

Close to what I neeed but looking just for the path to the file.

Thanks, Dennis

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Obtain Path on open workbook

OK. This works
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1)
Bracket needed to be reversed

Thanks Bob for getting me started in the right direction.

Dennis



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Obtain Path on open workbook

I thought you wanted the book name as well.

Glad you are sorted.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ssGuru" wrote in message
ups.com...
OK. This works
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1)
Bracket needed to be reversed

Thanks Bob for getting me started in the right direction.

Dennis



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to see full path name of open workbook? Joe User[_2_] Excel Discussion (Misc queries) 5 March 21st 10 08:29 PM
Open Workbook using URL instead of network path Raul Excel Programming 5 March 1st 06 03:53 PM
Get path of open workbook Peridox Excel Programming 1 November 29th 05 05:46 AM
how to open workbook without hardcoding path Michael Turner Excel Programming 3 November 20th 03 12:12 PM
Obtain full path to a directory pk Excel Programming 2 September 29th 03 07:07 PM


All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"