View Single Post
 
Old 04-02-2022, 06:12 AM
grNadpa grNadpa is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Mar 2022
Posts: 46
grNadpa is on a distinguished road
Default

Thank you @gmayor
Please confirm that I modified your example correctly. Specifically I added
Code:
Options.DefaultFilePath(wdDocumentsPath) = "C:\Users\Brian\Documents"
such that the entire test sub reads
Code:
Private Sub CommandButton3_Click()
Dim dtToday As String
Dim sPath As String
    Options.DefaultFilePath(wdDocumentsPath) = "C:\Users\Brian\Documents" 
    sPath = Options.DefaultFilePath(wdDocumentsPath) & "\"
    dtToday = Format(Date, "ddmmyyyy")
    MsgBox sPath & "Waiver_" & dtToday & ".docx"
    ActiveDocument.SaveAs2 sPath & "Waiver_" & dtToday & ".docx"
End Sub
Final question: Does capturing the path before changing it, then restoring it after the SaveAs2 serve as 'Best Practices' ?
Reply With Quote