View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Héctor Miguel Héctor Miguel is offline
external usenet poster
 
Posts: 434
Default How can I show the current file name in a cell.

hi, Patrick !

How do you get excel to return the name of the current workbook into a certain cell.
I can get the directory name by typing =Info("directory"), but I cannot get the filename.
Is there a function that will return the current file name.


for the current (and saved) workbook...

path: =left(cell("filename"),find("[",cell("filename"))-2)
name: =mid(cell("filename"),find("[",cell("filename"))+1,find("]",cell("filename"))-find("[",cell("filename"))-5)
sheet: =mid(cell("filename"),search("]",cell("filename"))+1,now())

when the workbook has only one sheet names same as the workbook...
sheet: =mid(cell("filename"),if(iserror(find("]",cell("filename"))),lookup(2,1/(mid(cell("filename"),row($1:$255),1)="\"),row($1: $255))+1,find("]",cell("filename"))+1),31)

hth,
hector.