Fix Word VBA SaveAs Path Errors from SharePoint Templates
Question details
The user needs a Word VBA macro to save a document to a shared network folder when its template is opened from SharePoint.

- Product
- Microsoft Word VBA and SharePoint
- Device & OS
- not provided
- Scenario
- A macro saves successfully when the template runs from a mapped shared drive, but it must also work when the template is launched from SharePoint.
- Observed behavior
- Word displays a path error when the SharePoint-launched template attempts to save to the network location.
Identify the target folder's UNC path, such as \\server\share\folder, and confirm that you can open it and create a file there. Check which document the macro should save and whether it needs a macro-enabled file format.
Use a fully qualified UNC path in the Word VBA macro
Use this approach to avoid relying on a mapped drive letter or the SharePoint document's current location.
In Word, open the template and press Alt+F11. Find the macro that calls SaveAs or SaveAs2.
Replace the S: drive or relative path in the save command with the full UNC path and filename. For example: ActiveDocument.SaveAs2 FileName:="\\server\share\folder\output.docx", FileFormat:=wdFormatXMLDocument. Substitute your actual server, share, folder, and filename.
Verify that ActiveDocument is the document you intend to save. If the saved document must contain macros, use a .docm filename and the matching wdFormatXMLDocumentMacroEnabled format instead.
Run the macro once with the template opened from the network location and again with it opened from SharePoint. Confirm that the output appears in the target folder.

Check the working directory and network folder access
Use these checks if the macro still reports a path error or relies on a relative filename.
Edit Word Documents with WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with Office documents. Its Word format support helps you move documents into WPS for everyday editing, although it does not fix Microsoft Word VBA or SharePoint path errors.

Frequently Asked Questions
Why might an S: drive path fail when a template opens from SharePoint?
The mapped drive may not be available in the Word session, or the macro may be relying on a different working directory. Use the share's full UNC path in SaveAs2 and verify access from that session.
What UNC path should I use in SaveAs2?
Use the network server, share, folder, and output filename, such as \\server\share\folder\output.docx. Replace the example components with the actual destination.
Can ChangeFileOpenDirectory fix a relative save path?
It can set the directory used by a relative filename. Add ChangeFileOpenDirectory with the target folder before saving, but use a fully qualified SaveAs2 path when possible to make the destination explicit.
How do I save a document that needs to retain macros?
Use a .docm filename and set the SaveAs2 FileFormat argument to wdFormatXMLDocumentMacroEnabled. A .docx file does not retain VBA macros.
What should I check if the UNC path also fails?
Open the UNC folder in your file browser and test whether you can create a file. In the VBA editor, inspect the document reference and full filename used by the SharePoint-launched macro, then check network access and write permissions.




