Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Backup to multiple locations

I found a great VBA macro for Word (see below) that allows me to save
to multiple locations simultaneously. I would like to do the same in
Excel. Even better would be something that auto saves (at set
interval) to multiple locations.

I tried to use the Word code in Excel, but I guess the methods are
different.
Thanks

Sub SaveToTwoLocations()
Dim strFileA As String
Dim strFileB As String
Dim strFileC As String

'Save first just to be safe
ActiveDocument.Save
strFileA = ActiveDocument.Name
'Capture the name of the current (real) doc before the 'SveAs' changes
it
strFileC = ActiveDocument.FullName

'Define backup paths
strFileB = "C:\Documents and Settings\Administrator\My Documents\Backup
\MS Word\SaveTwoLocations\" & strFileA
strFileB2 = "H:\Word Backups - SaveToTwoLocations\" & strFileA

'Save backups
ActiveDocument.SaveAs FileName:=strFileB
ActiveDocument.SaveAs FileName:=strFileB2

'Set the current (active) doc back to the original
ActiveDocument.SaveAs FileName:=strFileC

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Backup to multiple locations

You simply have to change ActiveDocument to either activeworkbook or
thisworkbook.

"livetohike" wrote:

I found a great VBA macro for Word (see below) that allows me to save
to multiple locations simultaneously. I would like to do the same in
Excel. Even better would be something that auto saves (at set
interval) to multiple locations.

I tried to use the Word code in Excel, but I guess the methods are
different.
Thanks

Sub SaveToTwoLocations()
Dim strFileA As String
Dim strFileB As String
Dim strFileC As String

'Save first just to be safe
ActiveDocument.Save
strFileA = ActiveDocument.Name
'Capture the name of the current (real) doc before the 'SveAs' changes
it
strFileC = ActiveDocument.FullName

'Define backup paths
strFileB = "C:\Documents and Settings\Administrator\My Documents\Backup
\MS Word\SaveTwoLocations\" & strFileA
strFileB2 = "H:\Word Backups - SaveToTwoLocations\" & strFileA

'Save backups
ActiveDocument.SaveAs FileName:=strFileB
ActiveDocument.SaveAs FileName:=strFileB2

'Set the current (active) doc back to the original
ActiveDocument.SaveAs FileName:=strFileC

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Backup to multiple locations

See the VBA help in Excel for SaveCopyAs

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Joel" wrote in message ...
You simply have to change ActiveDocument to either activeworkbook or
thisworkbook.

"livetohike" wrote:

I found a great VBA macro for Word (see below) that allows me to save
to multiple locations simultaneously. I would like to do the same in
Excel. Even better would be something that auto saves (at set
interval) to multiple locations.

I tried to use the Word code in Excel, but I guess the methods are
different.
Thanks

Sub SaveToTwoLocations()
Dim strFileA As String
Dim strFileB As String
Dim strFileC As String

'Save first just to be safe
ActiveDocument.Save
strFileA = ActiveDocument.Name
'Capture the name of the current (real) doc before the 'SveAs' changes
it
strFileC = ActiveDocument.FullName

'Define backup paths
strFileB = "C:\Documents and Settings\Administrator\My Documents\Backup
\MS Word\SaveTwoLocations\" & strFileA
strFileB2 = "H:\Word Backups - SaveToTwoLocations\" & strFileA

'Save backups
ActiveDocument.SaveAs FileName:=strFileB
ActiveDocument.SaveAs FileName:=strFileB2

'Set the current (active) doc back to the original
ActiveDocument.SaveAs FileName:=strFileC

End Sub


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
Multiple Users - Different PC/Locations teelee Excel Worksheet Functions 2 January 7th 10 05:37 AM
Ranking based on sum across multiple locations Ryan[_3_] Excel Worksheet Functions 1 February 28th 08 09:19 PM
save to multiple locations simultaneously MOSwannabe Excel Discussion (Misc queries) 1 October 29th 07 07:00 PM
Need help saving to multiple locations Bruise[_3_] Excel Programming 5 July 17th 07 05:26 PM
How do I advance filter to multiple locations at once? imills Excel Worksheet Functions 3 February 1st 06 06:12 PM


All times are GMT +1. The time now is 07:33 PM.

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

About Us

"It's about Microsoft Excel"