J
jimc
I am new to VBA, I have seen here and on other newsgroups that it is
unwise to save a word file directly to removeable media because of the
various temp files created. Can I use Filecopy on a closed file
instead? My snippet is below. I have used and modified the code from
Graham Mayors site (http://www.gmayor.com/index.htm):
Sub Backup()
Dim strFileA, strFileB, strFileC, strFileD
ActiveDocument.Save
strFileA = ActiveDocument.Name
' backup file to different folder every other day
If Even = (Day(Now) Mod 2) - 1 Then
strFileB = "C:\Documents and Settings\Jim.DELL5150\My
Documents\MyOddBackups\" & Format$(Now, "mmm d") & strFileA
Else
strFileB = "C:\Documents and Settings\Jim.DELL5150\My
Documents\MyEvenBackups\" & Format$(Now, "mmm d") & strFileA
End If
strFileC = ActiveDocument.FullName
ActiveDocument.SaveAs FileName:=strFileB
ActiveDocument.SaveAs FileName:=strFileC
' after closing backup file, copy it to USB flash drive
FileCopy strFileB, "F:\backups.doc"
End Sub
unwise to save a word file directly to removeable media because of the
various temp files created. Can I use Filecopy on a closed file
instead? My snippet is below. I have used and modified the code from
Graham Mayors site (http://www.gmayor.com/index.htm):
Sub Backup()
Dim strFileA, strFileB, strFileC, strFileD
ActiveDocument.Save
strFileA = ActiveDocument.Name
' backup file to different folder every other day
If Even = (Day(Now) Mod 2) - 1 Then
strFileB = "C:\Documents and Settings\Jim.DELL5150\My
Documents\MyOddBackups\" & Format$(Now, "mmm d") & strFileA
Else
strFileB = "C:\Documents and Settings\Jim.DELL5150\My
Documents\MyEvenBackups\" & Format$(Now, "mmm d") & strFileA
End If
strFileC = ActiveDocument.FullName
ActiveDocument.SaveAs FileName:=strFileB
ActiveDocument.SaveAs FileName:=strFileC
' after closing backup file, copy it to USB flash drive
FileCopy strFileB, "F:\backups.doc"
End Sub