View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Roger Govier[_3_] Roger Govier[_3_] is offline
external usenet poster
 
Posts: 2,480
Default file name and path in worksheet

Hi April

You could use the following Function
Function Fullpath()
Fullpath = ThisWorkbook.FullName
End Function

Usage =Fullpath() typed in any cell, will return the name and path into the
cell where it is entered
If the file has not been saved, then it will return just the filename e.g
Book1

If you save the function in Personal.xls it will always be available to you
in any workbook by typing
=Personal.xls!Fullpath()

Alternatively, to avoid typing that each time, you could create a defined
name in your current workbook
InsertnameDefine Name fpath Refers to =Personal.xls!Fullpath()
and just use
=fpath

If you already have a Personal.xls set up, copy the code and paste into a
module in the file.
If you don't have a Personal.xls, then
Open a new workbook
Copy the Code above
Alt+F11 to invoke the VB Editor
InsertModule
Paste code into white pane that appears
Alt+F11 to return to Excel
Save as Personal.xls in your XLSTART folder


--
Regards
Roger Govier

"april" wrote in message
...
is there a way to insert the file name and path in a worksheet - i'm not
talking about the footer in the print setup. i am looking for something
like
the NOW function.

thanks
--
aprilshowers