Search notes:

Excel function: cell

=cell(infoType, [reference])
infoType is one of
address Returns the text of the first cell in the reference.
col/ row Column/row number of reference
color EValuates to 1 if the cell has a color format for negative values (related to range.numberFormat?)
contents
filename The full filename the workbook.
format
parantheses
prefix
protect 0 if the cell is not locked, 1 otherwice.
type b if the cell is empty, l if the cell contains text, v for evertyhing else.
width An array with two element: cell width and a boolean value that indicates if this width corresponds to the default width.

cell("filename", ref)

cell("filename", a1) can be used to find the filename of an Excel workbook.
option explicit

sub main() ' {

  '
  ' In order for cell("filename", …) to return a value,
  ' we need to save the current workbook:
  '
    activeWorkbook.saveAs _
       fileName   := environ("TEMP") & "\" & "bla.xlsm" , _
       fileFormat := xlOpenXMLWorkbookMacroEnabled

  '
  ' The following evaluates to something like
  '   C:\Users\REN~1\AppData\Local\Temp\[bla.xlsm]Sheet1
  '
    cells(2, 2).formula = "=cell(""filename"", a1)"

end sub ' }
Github repository about-Excel, path: /functions/cell/filename.bas
Getting the path, including trailing backslash, to a workbook.
=left( cell("filename"; a1) ; find("[" ; cell("filename"; a1) )  -1)

See also

Compare with worksheet.fullName
The Worksheet function info("DIRECTORY") evaluates to the directory in which a workbook is stored)
cell is a volatile function.
Some notes about cells in relation to Excel's range object.
Excel worksheet functions

Index