Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default can you have excel automatically save in 2 locations

I need to make a backup onto a server for every file I save. Is there a way
I can have excel save 2 copies - one where I have access, and one in the
backup file in my server?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 430
Default can you have excel automatically save in 2 locations

In the past when I have had to do this I create a 'SAVE' button at the top of
the sheet. i then record a simple macro that saves the file to the local
computer and then saves the file to the server. I then attach the macro to
the save button. Then when I want to save I click the Save button on the
spreadsheet and it saves in both places.

"Saving a Backup every time" wrote:

I need to make a backup onto a server for every file I save. Is there a way
I can have excel save 2 copies - one where I have access, and one in the
backup file in my server?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default can you have excel automatically save in 2 locations

You could use a macro:

option explicit
sub SaveTwice()
with activeworkbook
.save
.savecopyas "C:\mybackups\" & .name
end with
end sub

Change the folder location to what you need.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Saving a Backup every time wrote:

I need to make a backup onto a server for every file I save. Is there a way
I can have excel save 2 copies - one where I have access, and one in the
backup file in my server?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 152
Default can you have excel automatically save in 2 locations

Dave I did something similar on close, It adds the date to the file name and
saves it in "//netusers*/Current Year". My problem is it leaves the program
in the directory "*.Current Year" on exit. How do I remain in the current
directory on exit?

"Dave Peterson" wrote:

You could use a macro:

option explicit
sub SaveTwice()
with activeworkbook
.save
.savecopyas "C:\mybackups\" & .name
end with
end sub

Change the folder location to what you need.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Saving a Backup every time wrote:

I need to make a backup onto a server for every file I save. Is there a way
I can have excel save 2 copies - one where I have access, and one in the
backup file in my server?


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 152
Default can you have excel automatically save in 2 locations

Current Code:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'On Close
Range("BckUp").Select
Application.ScreenUpdating = False
ActiveSheet.Unprotect
response = MsgBox(Prompt:="Would You Like to Create a Back-Up Copy?",
Buttons:=vbYesNoCancel + vbDefaultButton1, Title:="BACK-UP COPY")
If response = vbYes Then
BookName = ActiveWorkbook.Name
Selection = ClearContents
Selection = InputBox(Prompt:="Your Back-Up Form Name Will Be Like
the Window Below.", Title:="BACK-UP COPY", Default:=Range("BckUpDt").Text + "
" + (BookName))
If ActiveWorkbook.Saved = False Then ActiveWorkbook.SaveAs
On Error GoTo Oops
ChDir "\\Server1\Netusers\Current Year"
ActiveWorkbook.SaveCopyAs Filename:=Range("BckUp").Text
ActiveWorkbook.Saved = True
ChDir "\\Server1\Netusers\Lab"
Oops:
ChDir "\Current Year"
ActiveWorkbook.SaveCopyAs Filename:=Range("BckUp").Text
ActiveWorkbook.Saved = True
ChDir "\Pyro\Lab"
ElseIf response = vbCancel Then
Exit Sub
End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub

There are sub directories under "Lab". I Know I generate the change
directory. How can I do the same thing without the CD?
"Rookie 1st class" wrote:

Dave I did something similar on close, It adds the date to the file name and
saves it in "//netusers*/Current Year". My problem is it leaves the program
in the directory "*.Current Year" on exit. How do I remain in the current
directory on exit?

"Dave Peterson" wrote:

You could use a macro:

option explicit
sub SaveTwice()
with activeworkbook
.save
.savecopyas "C:\mybackups\" & .name
end with
end sub

Change the folder location to what you need.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Saving a Backup every time wrote:

I need to make a backup onto a server for every file I save. Is there a way
I can have excel save 2 copies - one where I have access, and one in the
backup file in my server?


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default can you have excel automatically save in 2 locations

First, I don't think that this line actually works:

ChDir "\\Server1\Netusers\Current Year"

I've never seen ChDir work on a UNC path. But the good thing is you don't need
to change drives/folders to save the file. You can just specify the path in the
..savecopyas line


ActiveWorkbook.SaveCopyAs _
Filename:=\\Server1\Netusers\Current Year\" & Range("BckUp").Text



Rookie 1st class wrote:

Current Code:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'On Close
Range("BckUp").Select
Application.ScreenUpdating = False
ActiveSheet.Unprotect
response = MsgBox(Prompt:="Would You Like to Create a Back-Up Copy?",
Buttons:=vbYesNoCancel + vbDefaultButton1, Title:="BACK-UP COPY")
If response = vbYes Then
BookName = ActiveWorkbook.Name
Selection = ClearContents
Selection = InputBox(Prompt:="Your Back-Up Form Name Will Be Like
the Window Below.", Title:="BACK-UP COPY", Default:=Range("BckUpDt").Text + "
" + (BookName))
If ActiveWorkbook.Saved = False Then ActiveWorkbook.SaveAs
On Error GoTo Oops
ChDir "\\Server1\Netusers\Current Year"
ActiveWorkbook.SaveCopyAs Filename:=Range("BckUp").Text
ActiveWorkbook.Saved = True
ChDir "\\Server1\Netusers\Lab"
Oops:
ChDir "\Current Year"
ActiveWorkbook.SaveCopyAs Filename:=Range("BckUp").Text
ActiveWorkbook.Saved = True
ChDir "\Pyro\Lab"
ElseIf response = vbCancel Then
Exit Sub
End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub

There are sub directories under "Lab". I Know I generate the change
directory. How can I do the same thing without the CD?
"Rookie 1st class" wrote:

Dave I did something similar on close, It adds the date to the file name and
saves it in "//netusers*/Current Year". My problem is it leaves the program
in the directory "*.Current Year" on exit. How do I remain in the current
directory on exit?

"Dave Peterson" wrote:

You could use a macro:

option explicit
sub SaveTwice()
with activeworkbook
.save
.savecopyas "C:\mybackups\" & .name
end with
end sub

Change the folder location to what you need.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Saving a Backup every time wrote:

I need to make a backup onto a server for every file I save. Is there a way
I can have excel save 2 copies - one where I have access, and one in the
backup file in my server?

--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 152
Default can you have excel automatically save in 2 locations

Final Code:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'On Close
Range("BckUp").Select
Application.ScreenUpdating = False
ActiveSheet.Unprotect
response = MsgBox(Prompt:="Would You Like to Create a Back-Up Copy?",
Buttons:=vbYesNoCancel + vbDefaultButton1, Title:="BACK-UP COPY")
If response = vbYes Then
BookName = ActiveWorkbook.Name
Selection = ClearContents
Selection = InputBox(Prompt:="Your Back-Up Form Name Will Be Like
the_ Window Below.", Title:="BACK-UP COPY", Default:=Range("BckUpDt").Text +
" " +_ (BookName))
On Error GoTo Oops
ActiveWorkbook.SaveCopyAs Filename:="\\Server1\Netusers\Current
Year"_ & Range("BckUp").Text
Oops:
ActiveWorkbook.SaveCopyAs Filename:="\Pyro\Lab" & Range("BckUp").Text
ElseIf response = vbCancel Then
Exit Sub
End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub

For the originator: 01 Jan I rename "Current Year" to 200? and create a new
"Current Year". That way I don't have to rewrite my macros every year. I take
a date block "mm/dd/yy" and save a copy "mm-dd-yy" that is added to the name
of the workbook in a format that can be written to a filename. This example
works on a networked or stand alone computer. Delete the OOPS if your system
isn't networked.

For Dave; I owe you a carbonated beverage of your choice. Thank You.
Lou
PS. the original formula was written in Excel 97 and did change directories.

"Dave Peterson" wrote:

First, I don't think that this line actually works:

ChDir "\\Server1\Netusers\Current Year"

I've never seen ChDir work on a UNC path. But the good thing is you don't need
to change drives/folders to save the file. You can just specify the path in the
..savecopyas line


ActiveWorkbook.SaveCopyAs _
Filename:=\\Server1\Netusers\Current Year\" & Range("BckUp").Text



Rookie 1st class wrote:

Current Code:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'On Close
Range("BckUp").Select
Application.ScreenUpdating = False
ActiveSheet.Unprotect
response = MsgBox(Prompt:="Would You Like to Create a Back-Up Copy?",
Buttons:=vbYesNoCancel + vbDefaultButton1, Title:="BACK-UP COPY")
If response = vbYes Then
BookName = ActiveWorkbook.Name
Selection = ClearContents
Selection = InputBox(Prompt:="Your Back-Up Form Name Will Be Like
the Window Below.", Title:="BACK-UP COPY", Default:=Range("BckUpDt").Text + "
" + (BookName))
If ActiveWorkbook.Saved = False Then ActiveWorkbook.SaveAs
On Error GoTo Oops
ChDir "\\Server1\Netusers\Current Year"
ActiveWorkbook.SaveCopyAs Filename:=Range("BckUp").Text
ActiveWorkbook.Saved = True
ChDir "\\Server1\Netusers\Lab"
Oops:
ChDir "\Current Year"
ActiveWorkbook.SaveCopyAs Filename:=Range("BckUp").Text
ActiveWorkbook.Saved = True
ChDir "\Pyro\Lab"
ElseIf response = vbCancel Then
Exit Sub
End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub

There are sub directories under "Lab". I Know I generate the change
directory. How can I do the same thing without the CD?
"Rookie 1st class" wrote:

Dave I did something similar on close, It adds the date to the file name and
saves it in "//netusers*/Current Year". My problem is it leaves the program
in the directory "*.Current Year" on exit. How do I remain in the current
directory on exit?

"Dave Peterson" wrote:

You could use a macro:

option explicit
sub SaveTwice()
with activeworkbook
.save
.savecopyas "C:\mybackups\" & .name
end with
end sub

Change the folder location to what you need.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Saving a Backup every time wrote:

I need to make a backup onto a server for every file I save. Is there a way
I can have excel save 2 copies - one where I have access, and one in the
backup file in my server?

--

Dave Peterson


--

Dave Peterson

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
Default Save To directory doesn't work Excel 2003 [email protected] Excel Discussion (Misc queries) 1 March 20th 06 11:44 PM
when I save a worksheet made in excel 2003 to excel 97, apan2so Excel Discussion (Misc queries) 0 March 13th 06 02:13 AM
How to save sheets in new excel files, automatically? SuperDuck Excel Worksheet Functions 1 October 22nd 05 09:37 AM
create a macro to save excel sheet Moussa Hawas Excel Worksheet Functions 1 October 16th 05 09:19 PM
Excel 2003: File->Close without saving changes (save menu does no. Wai-Yee Excel Discussion (Misc queries) 5 July 25th 05 11:49 PM


All times are GMT +1. The time now is 05:09 PM.

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"