Returns the name of the active workbook.
* For instructions on how to add a function to a workbook refer to the page under Inserting Functions
'rgeCellRange - (Optional) A cell in the workbook you want the name of.
Public Function WORKBOOKFILENAME(Optional ByVal rgeCellRange As Range = Nothing) As String
If rgeCellRange Is Nothing Then
WORKBOOKNAME = ActiveWorkbook.Name
WORKBOOKNAME = rgeCellRange.Parent.Parent.Name
There will not be a file extension if the workbook has not been saved.
You can use the following formula
If you want the name of a different open workbook, you can use the optional argument to reference a cell in that open workbook
In PowerPak this function is called FILENAME
You can use the WORKBOOKPATH user defined function to return the folder path of the active workbook
You can use the WORKBOOKFULLPATH user defined function to return the full path and name of the active workbook
© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext