• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. Macro Hacks > 91. Retrieve a Workbook’s Name and Path

Retrieve a Workbook’s Name and Path

Every now and then you might want a cell to return the name of a workbook, or even the workbook’s filename and path. With this hack, it’s easy to retrieve a workbook’s name and path.

The three user-defined functions we explain in this section place the name of a workbook into a cell, or the workbook’s filename and path into a cell. The first two examples, MyName and MyFullName, do not take any arguments. The last one, SheetName, is used in place of nesting the MID and other functions inside the CELL function to get the sheet name, a process that commonly would require the following unwieldy formula:

=MID(CELL("filename",$A$1),FIND("]",CELL("filename",$A$1))+1,255)


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint