View Full Version : Save open document with different name
plektrum
04-14-2015, 06:20 AM
I need a macro that saves an already open document with a different filename than is currently used (not as a new document). Is this possible?
fumei
04-14-2015, 06:51 PM
Why not just do a Save As?
plektrum
04-14-2015, 10:36 PM
I need to keep the number of documents as low as possible. Maybe I need to use save as and then delete the original document?
gmayor
04-15-2015, 02:41 AM
You don't need Word for this.
Just rename it using Windows Explorer.
Right Click > Rename
or F2
James88
04-24-2015, 04:58 PM
As above, you don't need a macro to do this but obviously one could do it if there's a need to.
Would the macro need to say do a save as and then say delete the original file once it's closed?
Hi,
I use this macro when I am working on long documents and I want to be sure that I have multiple, time-stamped versions of the document as I progress through it. It gives me the ability to minimize data loss in case Word hangs etc. It saves your current document as a word file whose name is a date_time timestamp:
MYFOLDER = ActiveDocument.Path & "\"
MYSTRING = Format(Now(), "yyyymmddhhmmss")
MYSTRING1 = Left(MYSTRING, 8)
MYSTRING2 = Right(MYSTRING, 6)
MYSTRING3 = MYSTRING1 & "_" & MYSTRING2
strDOCNAME = MYFOLDER & MYSTRING3 & ".docx"
ActiveDocument.SaveAs2 FileName:=strDOCNAME, FileFormat:=wdFormatDocumentDefault
I hope this helps
cheers
gmayor
04-30-2015, 09:37 PM
If you want multiple time stamped copies (which incidentally was not what was requested) take a look at http://www.gmayor.com/SaveVersionsAdd-In.htm.
As James88 said, to do what the OP asked for requires a two stage process, to save with an alternative name (checking to ensure that the new name didn't exist as a macro would otherwise simply overwrite the original) then delete the previously named file. If you just want a file with a new name, it is much simpler to save and close then rename it from the file dialog.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.