Hi Everybody:
With your help, I was able to modify my macro so it:
1.) saves the file I'm working on to the A:\ drive (i.e. creates a backup of the file)
2.) Returns to the file where I was working on it (i.e. File --> Save As again and switches back to the file on, say, the H:\ drive)
I was able to get this macro to work so it keeps the active file's name (i.e. when it saves, it keeps the file's name, regardless of what it's called), but now I'm stuck with how to modify the macro so it keeps the active path. For example, if I'm working on a file that is saved in a subfolder on the H:\ drive, but next time I'm working on a file that is saved in the root of the H:\ drive, how can I modify my macro so it keeps, not only the active file's name, but it keeps the active file's path?
For example, in the macro below, is there a way to modify the second ChangeFileOpenDirectory to return to the directory the user was in prior to starting the macro (i.e. before the macro creates a backup of the file/switches to the A:\ drive)? In other words, as it stands now, the macro keeps the active document's name, but it will always save the file in step two to H:\training\Class Files\....how can I make the macro more generic so it saves files in the proper location (i.e. I don't want to hard code a path for this step, I want it to remember/reference the location prior to beginning the process). I hope this makes sense...
Here's what I have:
Sub SaveToDisk()
ChangeFileOpenDirectory "A:\"
ActiveDocument.SaveAs FileName:=ActiveDocument.Name, FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
ChangeFileOpenDirectory "H:\training\Class Files\"
ActiveDocument.SaveAs FileName:=ActiveDocument.Name, FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
End Sub
I would GREATLY appreciate any help and/or suggestions you may have.
Many thanks, in advance!
With your help, I was able to modify my macro so it:
1.) saves the file I'm working on to the A:\ drive (i.e. creates a backup of the file)
2.) Returns to the file where I was working on it (i.e. File --> Save As again and switches back to the file on, say, the H:\ drive)
I was able to get this macro to work so it keeps the active file's name (i.e. when it saves, it keeps the file's name, regardless of what it's called), but now I'm stuck with how to modify the macro so it keeps the active path. For example, if I'm working on a file that is saved in a subfolder on the H:\ drive, but next time I'm working on a file that is saved in the root of the H:\ drive, how can I modify my macro so it keeps, not only the active file's name, but it keeps the active file's path?
For example, in the macro below, is there a way to modify the second ChangeFileOpenDirectory to return to the directory the user was in prior to starting the macro (i.e. before the macro creates a backup of the file/switches to the A:\ drive)? In other words, as it stands now, the macro keeps the active document's name, but it will always save the file in step two to H:\training\Class Files\....how can I make the macro more generic so it saves files in the proper location (i.e. I don't want to hard code a path for this step, I want it to remember/reference the location prior to beginning the process). I hope this makes sense...
Here's what I have:
Sub SaveToDisk()
ChangeFileOpenDirectory "A:\"
ActiveDocument.SaveAs FileName:=ActiveDocument.Name, FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
ChangeFileOpenDirectory "H:\training\Class Files\"
ActiveDocument.SaveAs FileName:=ActiveDocument.Name, FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
End Sub
I would GREATLY appreciate any help and/or suggestions you may have.
Many thanks, in advance!