Force the user to save documents into a particular folder or a subfolder of that folder
Article contributed by Bill Coan
Use a FileSave macro that will run in place of Word's own built-in File Save routine. The macro allows the user to save directly to a target folder or to a subfolder within that folder, but not to a location outside the target folder.
To modify this macro for your own needs, change the path to whatever you want in the line:
.Name = "C:\My Documents\Test"
... and modify both the path and the number of characters in the Left$ test, in the line:
If Left$(CurDir, 20) <> "C:\My Documents\Test" Then
Sub FileSave()
Dim UserSaveDialog
As Dialog
Set UserSaveDialog =
Dialogs(wdDialogFileSaveAs)
'save changes if doc has been saved previously
If ActiveDocument.Path <> "" Then
ActiveDocument.Save
Exit Sub
End If
With UserSaveDialog
.Name = "C:\My Documents\Test"
If .Display
Then
'if user
doesn't click Cancel button,
'quit with message if user has
switched out of target folder,
'but don't quit if user has made a
'subfolder within the target folder
If
LCase$(Left$(CurDir, 20)) <> "c:\my documents\test"
Then
MsgBox
"Documents can't be saved in that folder. Please try again."
Exit Sub
End Iff
'save the
document according to user preferences
UserSaveDialog.Execute
End If
End Withh
End Sub