Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Code to save to 2 locations


I currently have code to save my workbook after running a couple o
procedures. I would also like to save the workbook to another locatio
as a backup on a different drive. Is it possible to save a workbook t
multiple locations in the same code set? Below is the code I alread
have.


Sub moverange()
x = Cells(Rows.Count, "A").End(xlUp).Row + 1
range(Cells(x, "A"), Cells(x + 0, "H")).Value
range("New_Entry").Value
range("New_Entry").Select
Selection.Clearcontents
range("A2").Select
ActiveWorkbook.Save
End Sub

Thank you,
Sinjin34

--
Sinjin34
-----------------------------------------------------------------------
Sinjin341's Profile: http://www.excelforum.com/member.php...fo&userid=1461
View this thread: http://www.excelforum.com/showthread.php?threadid=26882

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA Code to save to 2 locations

to save to the second location (this avoids changing the activeworkbook to
the backup copy)

range("A2").Select
ActiveWorkbook.Save
Application.DisplayAlerts = False
Activeworkbook.SaveCopyAs "C:\MyBackupFolder\" & ActiveWorkbook.Name
Application.DisplayAlerts = True

This overwrites a previous backup (with the same name) without prompt.

--
Regards,
Tom Ogilvy

"Sinjin341" wrote in message
...

I currently have code to save my workbook after running a couple of
procedures. I would also like to save the workbook to another location
as a backup on a different drive. Is it possible to save a workbook to
multiple locations in the same code set? Below is the code I already
have.


Sub moverange()
x = Cells(Rows.Count, "A").End(xlUp).Row + 1
range(Cells(x, "A"), Cells(x + 0, "H")).Value =
range("New_Entry").Value
range("New_Entry").Select
Selection.Clearcontents
range("A2").Select
ActiveWorkbook.Save
End Sub

Thank you,
Sinjin341


--
Sinjin341
------------------------------------------------------------------------
Sinjin341's Profile:

http://www.excelforum.com/member.php...o&userid=14616
View this thread: http://www.excelforum.com/showthread...hreadid=268820



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default VBA Code to save to 2 locations

One way:

ActiveWorkbook.SaveCopyAs "C:\book2.xls"

saves it as a backup copy and does not change the active file to a new
filename.

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Sinjin341" wrote in message
...

I currently have code to save my workbook after running a couple of
procedures. I would also like to save the workbook to another location
as a backup on a different drive. Is it possible to save a workbook to
multiple locations in the same code set? Below is the code I already
have.


Sub moverange()
x = Cells(Rows.Count, "A").End(xlUp).Row + 1
range(Cells(x, "A"), Cells(x + 0, "H")).Value =
range("New_Entry").Value
range("New_Entry").Select
Selection.Clearcontents
range("A2").Select
ActiveWorkbook.Save
End Sub

Thank you,
Sinjin341


--
Sinjin341
------------------------------------------------------------------------
Sinjin341's Profile:

http://www.excelforum.com/member.php...o&userid=14616
View this thread: http://www.excelforum.com/showthread...hreadid=268820



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
Save document to multiple locations Bob[_13_] New Users to Excel 1 January 19th 08 08:29 PM
save to multiple locations simultaneously MOSwannabe Excel Discussion (Misc queries) 1 October 29th 07 07:00 PM
can you have excel automatically save in 2 locations Saving a Backup every time Excel Discussion (Misc queries) 6 September 30th 06 05:49 PM
can you automatically save files to two different locations? thrasher Excel Discussion (Misc queries) 1 June 26th 06 04:24 PM
Is it possible to save an Excel file to 2 locations? Chris_7_1 New Users to Excel 1 January 7th 05 01:03 AM


All times are GMT +1. The time now is 11:53 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"