Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving a file automatically everytime it is closed
I'd like to be able to save a copy of a document onto my local drive
everytime I change the original on our server. Is there a macro I can use to save it automatically everytime the document on the server is closed? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving a file automatically everytime it is closed
Set the security level to low/medium in (Tools|Macro|Security). From workbook
press Alt+F11 to launch VBE (Visual Basic Editor). From the left treeview search for the workbook name and click on + to expand it. Within that you should see the following VBAProject(Your_Filename) Microsoft Excel Objects Sheet1(Sheet1) Sheet2(Sheet2) Sheet3(Sheet3) This Workbook Double click 'This WorkBook' and paste the below code to the right code pane. The workbook will be saved to c:\ with file name containing date and time. Private Sub Workbook_BeforeClose(Cancel As Boolean) If Me.Saved = False Then Me.SaveCopyAs "c:\Backup" & Format(Now(), "YYMMDDhhmmss") & ".xls" End If End Sub If this post helps click Yes --------------- Jacob Skaria "Wombat" wrote: I'd like to be able to save a copy of a document onto my local drive everytime I change the original on our server. Is there a macro I can use to save it automatically everytime the document on the server is closed? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving a file automatically everytime it is closed
Doesnt seem to work... I'm using a German version of Excel. Is the
programming language different? "Jacob Skaria" wrote: Set the security level to low/medium in (Tools|Macro|Security). From workbook press Alt+F11 to launch VBE (Visual Basic Editor). From the left treeview search for the workbook name and click on + to expand it. Within that you should see the following VBAProject(Your_Filename) Microsoft Excel Objects Sheet1(Sheet1) Sheet2(Sheet2) Sheet3(Sheet3) This Workbook Double click 'This WorkBook' and paste the below code to the right code pane. The workbook will be saved to c:\ with file name containing date and time. Private Sub Workbook_BeforeClose(Cancel As Boolean) If Me.Saved = False Then Me.SaveCopyAs "c:\Backup" & Format(Now(), "YYMMDDhhmmss") & ".xls" End If End Sub If this post helps click Yes --------------- Jacob Skaria "Wombat" wrote: I'd like to be able to save a copy of a document onto my local drive everytime I change the original on our server. Is there a macro I can use to save it automatically everytime the document on the server is closed? |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving a file automatically everytime it is closed
Scrap the last post... I've played around with it and it works! Thanks for
your help "Jacob Skaria" wrote: Set the security level to low/medium in (Tools|Macro|Security). From workbook press Alt+F11 to launch VBE (Visual Basic Editor). From the left treeview search for the workbook name and click on + to expand it. Within that you should see the following VBAProject(Your_Filename) Microsoft Excel Objects Sheet1(Sheet1) Sheet2(Sheet2) Sheet3(Sheet3) This Workbook Double click 'This WorkBook' and paste the below code to the right code pane. The workbook will be saved to c:\ with file name containing date and time. Private Sub Workbook_BeforeClose(Cancel As Boolean) If Me.Saved = False Then Me.SaveCopyAs "c:\Backup" & Format(Now(), "YYMMDDhhmmss") & ".xls" End If End Sub If this post helps click Yes --------------- Jacob Skaria "Wombat" wrote: I'd like to be able to save a copy of a document onto my local drive everytime I change the original on our server. Is there a macro I can use to save it automatically everytime the document on the server is closed? |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Saving a file automatically everytime it is closed
What if someone screws up and does not want to save the screwed-up changes
to the local drive? You might want a "Do you want to save changes" option before closing. Gord Dibben MS Excel MVP On Wed, 28 Oct 2009 05:33:01 -0700, Wombat wrote: I'd like to be able to save a copy of a document onto my local drive everytime I change the original on our server. Is there a macro I can use to save it automatically everytime the document on the server is closed? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Accidentally closed file without saving | Excel Discussion (Misc queries) | |||
I closed an excel file without saving, is there a way to recover? | Excel Discussion (Misc queries) | |||
I closed a file without saving it, can i recover the information? | Excel Discussion (Misc queries) | |||
How to recover excel file that was closed without saving? | Excel Discussion (Misc queries) | |||
How can I retrieve a file that was closed without saving? | Excel Discussion (Misc queries) |