Word VBA, Get Current File Path and Name

In this article I will explain how you can get the current path and name of the word document you are working with.


File Path:

The file path can be obtained using the code below:

Dim strPath As String
strPath = ThisDocument.FullName
MsgBox (strPath)

Result:

Get File Path, Word Document

Note: If the file has not been saved yet you will get something like this:

File Not Saved Full Path Word DOcument


Get File Name:

The file name can be obtained using the code below:

Dim strPath As String
strPath = ThisDocument.Name
MsgBox (strPath)

Result:

File Name Word Document

You can download the file and code related to this article from the link below:

See also:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website www.software-solutions-online.com

2 thoughts on “Word VBA, Get Current File Path and Name”

Leave a Reply

Your email address will not be published. Required fields are marked *