A family of Microsoft word processing software products for creating web, email, and print documents.
Yes. Word (and other Office applications) have a limit on the total length of the full path plus file name (including the extension) when opening or saving files.
From the documentation:
- For Word, PowerPoint, and Access, the total length of the path and file name (including extension) must not exceed 259 characters.
- For Excel, the total length must not exceed 218 characters.
This total includes:
- The drive specification (for example,
C:\– 3 characters) - All folder names in the path
- The backslashes between folders
- The file name and its extension
If a Documents.Open call in VBA uses a path that exceeds this limit, Word can fail to open the document and may show errors such as:
-
Filename is not valid. -
The file could not be accessed. -
The path you entered, 'filename', is too long. Enter a shorter path.
To resolve the issue for long paths in VBA:
- Shorten the file name, and/or
- Move the document to a folder with a shorter path, and/or
- Rename one or more folders in the path to shorter names.
Then update the path used in the Documents.Open statement so that the total length is within the limit.
References: