PC Review


Reply
Thread Tools Rate Thread

Backup to multiple locations

 
 
livetohike
Guest
Posts: n/a
 
      4th May 2008
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 With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      4th May 2008
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 With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      4th May 2008
See the VBA help in Excel for SaveCopyAs

--

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


"Joel" <(E-Mail Removed)> wrote in message news:05202C6A-04A9-4B0A-974E-(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excluding locations from a backup Georgios Kasselakis Windows Vista File Management 3 24th Jul 2008 01:59 AM
Data Locations & Backup Jeff Gaines Windows Vista General Discussion 6 8th Dec 2006 02:52 PM
Re: Data Locations & Backup Steve Cochran Windows Vista Mail 1 8th Dec 2006 02:13 PM
Keep an online backup of you Outlook, use it across several locations and access it via web browsers! info@insynch.websupplier.net Microsoft Outlook Discussion 0 12th Apr 2006 11:23 PM
adding 2 more locations to a backup script Roland Microsoft Windows 2000 CMD Promt 1 19th Aug 2005 05:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:52 AM.