In this post, you will be learning how to get the full File Path and File name using Excel VBA in your Excel Spreadsheet.
The file path and file name using Excel VBA can be accessed using the ‘.Path’ and ‘.FullName‘ properties.
How to Get the File Path using Excel VBA?
The Path property returns the complete, saved path of the workbook -Excel file.
How to Get File Name using Excel VBA?
The FullName property returns the complete, saved path, including the name of the workbook.
Let’s see these properties with the help of an example.
- Create an Excel file and name it of your choice.
- Firstly, place a command button on your worksheet using the insert option in the Developer tab
Enter the following code in the VBA of the button:
MsgBox Workbooks("Developerpublish.com-Path and full name.xlsm.xlsm").Path
This returns the complete path to the current excel file.
This line returns the complete path, including the name of the active workbook.
You need to enter the exact file name to find its path.
Enter your email address to subscribe to this blog and receive notifications of new posts by email.