Path where Workbook is saved

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
T

Todd Huttenstine

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
 
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
 
=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),FIND("]",CELL("filename",A1)
)),"]",""),"[","")
 
Back
Top