-
How do I Save to shared folder with original file name using macros?
I have recorded a macro to save my files to a shared folder on my computer. Only issue being that when I use this on a new document it saves with the same file name and overwrites the document already saved. I want it to save the file with the original file name rather than the one used when recording the macro.
ChangeFileOpenDirectory "O:\Team NF CV's\"
ActiveDocument.SaveAs2 FileName:="O:\Team NF CV's\Jaumns.docx", FileFormat _
:=wdFormatXMLDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
:=False, SaveAsAOCELetter:=False, CompatibilityMode:=14
End Sub
It is the second line down where it uses the filename Jaumns.docx rather than the original unique file name.
Any help appreciated.
Last edited by klucas87; 06-25-2012 at 06:38 AM.
Reason: Not getting desired response
-
MSDN specifically states that file will be overwritten.
You'll have to test it's existence before hand.
[vba]FileExists = (Dir(FileName) > "")'Returns True/False[/vba]
-
Not sure what it is you're really looking to do
To save a doc opened from one folder back to your shared folder, I'd do something like this
[VBA]
Sub SaveIt()
ActiveDocument.SaveAs FileName:="O:\Team NF CV's\" & ActiveDocument.Name
End Sub
[/VBA]
Paul
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules