SharePoint Document Issues

Fix Word VBA SaveAs Path Errors from SharePoint Templates

Muhammad TalhaMuhammad Talha Nov 18, 2026 869 views

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.

Fix Word VBA SaveAs Path Errors from SharePoint Templates
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA editor

In Word, open the template and press Alt+F11. Find the macro that calls SaveAs or SaveAs2.

2
Replace the mapped path

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.

3
Check the document and format

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.

4
Test from both locations

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.

Use a fully qualified UNC path in the Word VBA macro
A UNC path still requires access: Using a UNC path does not grant network access or write permission. The SharePoint-launched Word session must be able to reach the share and write to the target folder.
Free Microsoft Office alternative

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.

Open and edit documents with a familiar word-processing interfaceWork with Microsoft Word formats, including DOC and DOCXReview and update documents without relying on the affected Word SaveAs macroUse a lightweight office suite with free features
microsoft office alternative - wps office

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.