ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Filepath into Cell (https://www.excelbanter.com/excel-programming/293887-insert-filepath-into-cell.html)

Cameron[_5_]

Insert Filepath into Cell
 
I was wondering if there was a way that I can insert the current filename's filepath into a document? I know how to insert into the header/footer but this is not suitable for what I require.

david mcritchie

Insert Filepath into Cell
 
Hi Cameron,
see my webpage
http://www.mvps.org/dmcritchie/excel/excel.htm

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Cameron" wrote in message ...
I was wondering if there was a way that I can insert the current filename's filepath into a document? I know how to insert into

the header/footer but this is not suitable for what I require.



Frank Kabel

Insert Filepath into Cell
 
Hi
File path and file name:
=CELL("filename",A1)

File path only
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1)

File name only
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CEL
L("filename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

The sheet name
=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1) )-FIND("]",CELL("file
name",A1),1))

--
Regards
Frank Kabel
Frankfurt, Germany


Cameron wrote:
I was wondering if there was a way that I can insert the current
filename's filepath into a document? I know how to insert into the
header/footer but this is not suitable for what I require.




All times are GMT +1. The time now is 02:27 PM.

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