View Single Post
 
Old 04-02-2022, 08:11 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

There is no need to change the path. Simply tell the macro where to save the document. The following will save the file in the appropriate place regardless of the current save location.

Code:
Private Sub CommandButton3_Click()
Dim dtToday As String
Dim sPath As String
    sPath = Options.DefaultFilePath(wdDocumentsPath) & "\"
    dtToday = Format(Date, "ddmmyyyy")
    ActiveDocument.SaveAs2 sPath & "Waiver_" & dtToday & ".docx"
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote