Hi Everybody:
I am trying - and failing - to create a macro that will:
1.) save the file I'm working on to the A:\ drive (i.e. create a backup of the file)
2.) Return to the file where I was working on it (i.e. File --> Save As again and switch back to the file on, say, the G:\ drive)
This is a pretty straight forward macro in terms of creating it for one particular file, but I'm wondering if there is a way to make it generic? In other words, when it does the File --> Save As, is there a way to write the macro so it keeps the name of the active file, rather than hard-coding a file name? For example, in the macro below, which accomplishes what I'm trying to do for one file, it uses the name "test.doc"...is there a way to modify this macro so it keeps the name of the active file and doesn't try to rename it to test.doc...in other words, is there a way to modify this macro so it will work for every file, not just test.doc?
Macro to BackUp test.doc:
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 1/5/2005 by
'
ChangeFileOpenDirectory "A:\"
ActiveDocument.SaveAs FileName:="test.doc", FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
ChangeFileOpenDirectory "G:\"
ActiveDocument.SaveAs FileName:="test.doc", 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!
I am trying - and failing - to create a macro that will:
1.) save the file I'm working on to the A:\ drive (i.e. create a backup of the file)
2.) Return to the file where I was working on it (i.e. File --> Save As again and switch back to the file on, say, the G:\ drive)
This is a pretty straight forward macro in terms of creating it for one particular file, but I'm wondering if there is a way to make it generic? In other words, when it does the File --> Save As, is there a way to write the macro so it keeps the name of the active file, rather than hard-coding a file name? For example, in the macro below, which accomplishes what I'm trying to do for one file, it uses the name "test.doc"...is there a way to modify this macro so it keeps the name of the active file and doesn't try to rename it to test.doc...in other words, is there a way to modify this macro so it will work for every file, not just test.doc?
Macro to BackUp test.doc:
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 1/5/2005 by
'
ChangeFileOpenDirectory "A:\"
ActiveDocument.SaveAs FileName:="test.doc", FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
ChangeFileOpenDirectory "G:\"
ActiveDocument.SaveAs FileName:="test.doc", 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!