ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Path where Workbook is saved (https://www.excelbanter.com/excel-programming/284080-path-where-workbook-saved.html)

Todd Huttenstine[_2_]

Path where Workbook is saved
 
What is the code that will detect the patch of where the
Active Workbook is saved and put that in cell A1? For
instance the Activate workbook is called Stats Manager and
is saved in C:\Data\Stats Manager.Xls. When the code is
run I need for it to put the value "C:\Data\Stats
Manager.Xls" in cell A1.


Thanx

Todd

Chip Pearson

Path where Workbook is saved
 
Todd,

For the path without the file name, use

Range("A1").Value = ActiveWorkbook.Path

For the full file name, including path and file name, use

Range("A1").Value = ActiveWorkbook.FullName


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Todd Huttenstine" wrote in
message ...
What is the code that will detect the patch of where the
Active Workbook is saved and put that in cell A1? For
instance the Activate workbook is called Stats Manager and
is saved in C:\Data\Stats Manager.Xls. When the code is
run I need for it to put the value "C:\Data\Stats
Manager.Xls" in cell A1.


Thanx

Todd




mudraker[_46_]

Path where Workbook is saved
 

Range("a1") = ThisWorkbook.Path

or

Range("a1") = ActiveWorkbook.Pat

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements

Tom Ogilvy

Path where Workbook is saved
 
=LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1)))
produces
C:\Data\[Stats Manager.Xls]

to remove the brackets

=substitute(Substitute(formula,"]",""),"[","")

=SUBSTITUTE(SUBSTITUTE(LEFT(CELL("filename",A1),FI ND("]",CELL("filename",A1)
)),"]",""),"[","")

--
Regards,
Tom Ogilvy


Todd Huttenstine wrote in message
...
What is the code that will detect the patch of where the
Active Workbook is saved and put that in cell A1? For
instance the Activate workbook is called Stats Manager and
is saved in C:\Data\Stats Manager.Xls. When the code is
run I need for it to put the value "C:\Data\Stats
Manager.Xls" in cell A1.


Thanx

Todd





All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com