View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Macro needed; save a file two (or more places) at the same time

Hi
you may try the following: Put this code in your workbook module:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim fileSaveName
ChDrive "C:"
ChDir "C:\Backup" 'change this to your needs
fileSaveName = Application.GetSaveAsFilename( _
InitialFilename:=Activeworkbook.name, _
fileFilter:="Excel Files (*.xls), *.xls")
If fileSaveName < False Then
ActiveWorkbook.SaveAs Filename:=fileSaveName
End If
end sub




--
Regards
Frank Kabel
Frankfurt, Germany

Sigurd wrote:
I've tried using the simple "record" function and saved a file on two
different locations, but it's not very dymanic since the name of the
workbook always is the same :) - does anyone know of a macro that one
can run in any workbook where I can specify a name and the locations
each time? (The macro is meant to be used for backup causes).

SGu