There are many situations where it is useful to be able to retrieve the location of the Excel file you are currently operating on when you are trying to retrieve values from another Excel file or save a file as a name using a macro. In this article, we will show you how to use the "FullName" command, which is useful in such cases.
To easily see where the currently open Excel file is savedAllows you to see the address where the book is saved Excel (Excel)Please also refer to the article on
If you do not want to include the book name, but want to get the destination folder name, you can use thePath" to get the path (save location) of the opened Excel file Excel(Excel) Macro(VBA)See also.
I would like to save an Excel file in a folder called "TEST" on my "desktop" and then put the VBA together in that Excel file.
Display in message box
Sub Show Save Location()
MsgBox ThisWorkbook.FullName
End Sub
If you run this macro, you will see

A message box like this appeared.
Write to cell
Sub Create List()
Range("B3").Value = ThisWorkbook.FullName
End Sub
If you run this macro, you will see

Thus, the "B3" cell could display the destination folder for this Excel file.
Conclusion
In this case, we added "FullName" to "ThisWorkbook" to get the storage location, but "ActiveWorkbook" can be used in the same way.
You can also use "Path" to get even the file name. For details, seePath" to get the path (save location) of the opened Excel file Excel(Excel) Macro(VBA)See also.
Comment