In my code I am writing a formula which refers to a workbook I previously defined. I was wondering if there is a difference between the Name and FullName property? The Microsoft website doesn't seem to make the distinction between the two clear.
In my code I am writing a formula which refers to a workbook I previously defined. I was wondering if there is a difference between the Name and FullName property? The Microsoft website doesn't seem to make the distinction between the two clear.
Name will return the name of a file (ex: workbook.xlsx)
FullName will return the path and name of a file (ex: c:\myDocuments\workbook.xlsx)
Path will return the path of a file (ex: c:\myDocuments)
You can quickly check in the Immediate Window (in the VBEditor, press CTRL+G) and type:
?Thisworkbook.Name
2019 Workbook Test.xlsm
?thisworkbook.FullName
K:\Excel Files\Primary Data\2019 Workbook Test.xlsm
Be aware, if the workbook hasn't yet been saved, both .Name and .FullName will only return "Book1" or similar. It's not until the workbook's been saved that they'll have complete data, such as "Book1.xlsm" or "C:\path...\Documents\Book1.xlsm".
Also, if you use ThisWorkbook.Name or ThisWorkbook.Fullname, they'll point to the workbook where your code is. For instance, if the code is in a workbook in your Documents folder, they'll be as stated above. But if you're working on code in your Personal Macro Workbook, they'll say Personal.xlsb and C:\Users\[username]\AppData\Roaming\Microsoft\Excel\XLStart\Personal.xlsb (or similar).