Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro needed; save a file two (or more places) at the same time

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
SL SL is offline
external usenet poster
 
Posts: 1
Default Macro needed; save a file two (or more places) at the same time

No, I don't, but this is exactly what I'm looking for, so
if you find an answewr would you be so kind as to share it
with me?
Thanks
SL
-----Original Message-----
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
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Macro needed; save a file two (or more places) at the same time

Take a look at the FileDialog object, its properties and methods. There is a
lot you can do with it, depending on your needs. Copy this into your
Personal.xls and give it a try. Give it a more creative name and parhaps map
it to a custom macro button.

Sub Main()
With Application.FileDialog(msoFileDialogSaveAs)
.InitialFileName = "C:\backupdir\*bak.xls"
.Show
End With
End Sub

You could also save a copy behind the scenes using something like the
following.
You can derive the saveas name from the existing filename if you like.
Activeworkbook.SaveCopyAs "c:\backupdir\" & activeworkbook.name & "_bak.xls"

You can trigger code execution in worksheet or workbook events.

Search for SaveCopyAs, FileDialog on Google in microsoft.public.excel.*
groups for more examples and discussion. There are many options.

"SL" wrote in message
...
No, I don't, but this is exactly what I'm looking for, so
if you find an answewr would you be so kind as to share it
with me?
Thanks
SL
-----Original Message-----
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
.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
Save as Macro in excel - Help needed!! Cillian Excel Discussion (Misc queries) 1 January 10th 06 06:52 PM
Help needed coding a macro to adjust the source of information each time it is run lbauckman Excel Programming 1 November 4th 03 08:13 AM
Macro to insert values from a file and save another sheet as a .txt file Frank[_16_] Excel Programming 2 August 28th 03 01:07 AM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


All times are GMT +1. The time now is 01:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"