Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 04-02-2022, 06:12 AM
grNadpa grNadpa is offline Set (temporary) SaveAs path Windows 10 Set (temporary) SaveAs path Office 2016
Advanced Beginner
Set (temporary) SaveAs path
 
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
 

Tags
path, save as docx, vba code



Similar Threads
Thread Thread Starter Forum Replies Last Post
Temporary work file reglilly Word 4 05-15-2018 12:13 PM
How to delete a temporary ~$ Word file? Belloc Word 3 08-16-2017 06:24 AM
Set (temporary) SaveAs path Change word temporary location mkhorrami Word 1 01-11-2016 04:09 AM
Where does Word 2010 save temporary files? JonahSnow Word 1 06-03-2015 12:31 AM
Set (temporary) SaveAs path VBS saveas API behaviour is different from Menu saveas Ahmed AbuZekry Word VBA 2 03-23-2015 02:14 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:13 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft