Save Backup Copy Before Closing

Aug 18, 2007

I was able to find the coding that I needed for being able to have a backup of my file. So when I save a workbook and close I also get a backup copy in another folder that is dated. But I am having problems getting the code to work. Probably because I do not understand it correctly. Here it is.

Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.SaveCopyAs "C:Documents and SettingsTeacherDesktopTEST" & _
Format( Date, "yyyy-mm-dd") & " - " & ThisWorkbook. Name
End Sub

Where it has, ThisWorkbook.Name, do I put the name of the workbook? Not sure.

View 7 Replies


ADVERTISEMENT

VBA Automatically Save Backup Copy In Other Folder

Jun 21, 2014

I need a macro that will create a backup copy of excel file in other folder when an original file is closing.

View 6 Replies View Related

Save Copy / Backup Of Workbook As Date In Certain Folder

Sep 7, 2013

I need to save an excel workbook when a "backup" button is pressed to a folder named "Backups". I want the name to be the "date" (09/07/2013) only and I want it to automatically overwrite anything previously saved for that day.

Book1.xlsm

View 2 Replies View Related

Auto-Save Backup Copy Of Spreadsheet On Weekly Basis?

Apr 26, 2013

I have a shared document used by as many as 11 different people. right now I go into a document and save a copy each week in case one of them messes it up.

just curious if that can be done automatically.

View 3 Replies View Related

Save Copy Of Workbook Without Closing Original

Jun 14, 2008

I want to have a user press a button on a worksheet page to save a copy of the workbook (and be able to name it and choose where to save it to) without closing or modifying the original. Note that if you "save as" manually it renames the workbook and closes the original.

View 7 Replies View Related

Save Backup Of Workbook Before Close

Dec 15, 2009

I call the macro below from a Workbook_BeforeClose sub; however, if the user has not saved changes before they hit the close then the Sub SaveFile runs and then after the backup save they are then asked do you want to save changes.

I initially had this sub run with Workbook_BeforeSave, but I don't really want to run this everytime the user selects save.

Any ideas on how to how the save changes first and then the backup?

View 6 Replies View Related

Auto Save Backup Every 15 Minutes

May 22, 2012

I am looking for some code to auto save my workbook into this location every 15 min,

View 1 Replies View Related

Save Changes When Closing

May 15, 2007

The following code is not working for me in the "ThisWorkbook" section:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
End Sub

Anytime a change is made it still asks if I want to save changes.

Also,
What code could I assign to a CommandButton that only allows a "Save As" function?

View 9 Replies View Related

Save Pop-up Not Appearing When Closing

Jan 9, 2008

Something seems to have happened to my Excel. When I make changes and close the workbook or application, the pop-up box asking "Do you want to save the changes you made to [Book1]?" no longer shows up.

So far I've tried running a macro with Application.DisplayAlerts = True, but that only seems to work while the macro is running.

View 9 Replies View Related

Auto Save When Closing File

Feb 16, 2004

I close an existing excel file I need to automatically save it to another folder as the same name. I don't want any prompts or save as boxes to appear when this happens.

I need to do this as I use the file all the time, but need to save it on to a network where others can view it.

View 9 Replies View Related

Backup Copy Of Workbook Macro

Nov 28, 2013

I am using this code to create a backup copy of my workbook:

Code:
Sub DOUGHMON()Dim fname
fname = "C:UsersAndrewDesktopWEEKLY SALES REPORTS" & Format(Now, "dd mmm yy") & ".xlsm"
ThisWorkbook.SaveAs Filename:=fname
End Sub

The only problem with this code is that my current file gets closed and the backup is open. I'm not sure if that is exactly what happens, but when it is done the current file that is open is the copy, and I would like the original file to stay open.

View 1 Replies View Related

How To Fix Column Width And Save It Before Closing File

May 30, 2002

I am trying to fix the width of a column everytime I open it but I can't. After I have fixed the column width and saved it before I close the file, when i reopen it, the column width will expand. The data source of that column is a real time query. I tried to lock the cell but when i locked it, I can't refresh the data from the query as it is locked. So, is there any way for me to achieve that?

View 4 Replies View Related

Closing Txt File Thru' Vba Without Save Changes Dialog Box Appearing

Jan 31, 2007

I want to close a tab delimited Txt file that is open in Excel, thru' a macro, without the save changes dialog box appearing.

View 2 Replies View Related

Automatically Save Sheet To New Workbook When Closing

Jun 30, 2008

I am in the process of setting up an Excel invoice. So far I have managed to implement the following:

On open: Incrementing invoice number
Cells cleared ready for next use

Private Sub Workbook_Open()
Sheets("Sales Invoice").Range("H2").Value = Sheets("Sales Invoice").Range("H2").Value + 1 .....................

There is only one task left I need to automate. On closing the document I would like a copy to be saved in a specific folder and be given the file name of a cell (B9). Obviously I would not want the 'saved copy' to retain the Incrementing invoice number or the clear cells function. Even if the invoice copy was exported as a flat jpeg that would be fine. I am using Office Exce 2003 (Sp2) - I have attached my invoice should anyone be kind enough to take a look.

View 3 Replies View Related

Linking Copy Onto Hidden Sheet For Backup

Nov 15, 2012

I have a database (attached) that has data entered into the "Progression" sheet. This data is continually updated, and once each row has a section date, I have a macro that moves the data from "Progression" to the "Complete" sheet (and from there, into a specific month sheet). I AM REALLY CONCERNED with data accidentally getting deleted (especially when/after getting moved to "Complete"). I know that you can link cell values from one worksheet to another, but since my data is continually changing in the Progression and Complete sheets, the linkage wouldn't maintain the correct cell values from day to day. Is there a better approach to creating "backup" data in excel than this linkage option? Preferably something that runs in the background without my input?

An option could be that I move my data from Progression into both the Complete sheet and then a hidden "Master" sheet when I run the macro. If I chose that route, how would I modify my coding to include transferring to the Master sheet as well?

Lastly, a simple linkage between the Master sheet and another sheet in a second workbook should be sufficient as a backup method?

View 1 Replies View Related

Making Backup Copy Of Active Workbook While Workbook Is Open

Jun 30, 2014

I run a model in Excel that automatically saves my file every xx iterations. After saving the file I want to make a backup of the file. Tried

[Code] .....

but get a permission denied error message.

I don't want to use .SaveAs as it is a huge file that takes a while to save and SaveAs has a tendency to break links that should not be broken..

View 13 Replies View Related

Create Copy Of Workbook Without Closing Original

Dec 3, 2007

I would like to create a copy of an open workbook.

Workbook.SaveAs would seem to be a possibility, but this closes the original workbook - I need to keep the original workbook open as well as the workbook it has been "SavedAs".

I do not want to close the first workbook and repoen it as there are instances where it may be protected and I do not want the user to have to reinput any passwords etc.

View 9 Replies View Related

Macro: Copy Cells To Another Workbook On Closing

Oct 31, 2006

I have a worksheet template with details in cell A1,B1,C1,D1,E1,F1,G1,H1 & I1and when the sheet closes I would like to save a copy of the cell contents to a different workbook called transaction history, is there any way that vba code could write this to the workbook and when the transaction happens again, it then writes the new transaction data to the next row within the same workbook transaction history

View 6 Replies View Related

Closing Workbook When Closing Userform

Sep 14, 2006

I have a userform which opens when the workbook opens. Ideally Id like to have the userform open without the workbook coming up and have the workbook close when you close the userform. If thats not doable then is there a way to just close the workbook when the userform is closed?

View 3 Replies View Related

Save Back Up Copy Online At Each Save

Mar 27, 2008

I have a sheet which I would like to back up online every time it is saved.

I have a sub, OnlineFile(), which I have used many times without any problems, which creates a .BAT file to use ftp to upload files onto our server. As arguments, it takes the local file path that you want to upload (or download to), the name of the file as you would like it stored, the online file path, and whether you want to upload the file onto the server, or download it off the server.

It should be very easy to combine the two: what I tried was:


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, cancel As Boolean)
ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "" & "Rubbish.xls"
Call OnlineFile(ThisWorkbook.Path & "" & "Rubbish.xls", "Rubbish.xls", "wwwrootexcelfilesMasters", "Upload")
Kill ThisWorkbook.Path & "" & "Rubbish.xls"
End Sub

Every time I ran this, the file got uploaded correctly, but Excel had a series of problems. Often the code ran fine the first time it was run, but crashed the second time round.

After a fair bit of troubleshooting, I found that the problem came about when the file was trying to save itself - i.e. after the end of the sub. If you pause any macros from running, it still saved fine, but when the code ran, it found errors, froze or closed excel.

My thought at this point was that the code was fragmented or something. I made a new sheet, and retyped just the relevant bits of code (i.e. the BeforeSave sub, the OnlineFile sub and created the form called by OnlineFile). The problem persisted.

I've come up with a workaround for this now (which uses the same OnlineFile sub & form, and works fine), but it's driving me crazy - why does this cause excel to die? Particularly on the second time through? The code seems far too simple to cause such problems - is there a bug in Excel perhaps (I'm using Excel 2000 on Windows XP).

View 9 Replies View Related

Backup At 2 Locations

Dec 15, 2012

The code below works. Now I need that while it does the backup file in the same location, we also took into C: Backup_Contabilidade. Finally also put the date and time.

VB:
Private Sub Workbook_BeforeClose(Cancel As Boolean) With Application
.CommandBars("Cell").Reset
End With

Application.DisplayAlerts = False

[Code] .....

View 3 Replies View Related

Automatic Backup

Mar 19, 2009

I’m aware of the AutoRecovery, but I’m looking for an Autoback (Auto save) itself. Is there one in Excel? ( I'm using 2003)

View 2 Replies View Related

Backup Spreadsheet In Several Locations?

May 13, 2014

I have a spreadsheet on a server, password protected, and certain columns, rows locked...

This is shared with 6 others and can only be accessed one at a time.

If It so that when the user saves the spreadsheet it saves over itself on the server it's located AND on the individual users computer as backup; how would I go about doing this!?

View 3 Replies View Related

Excel Backup Location?

Mar 29, 2006

Excel has a function, everytime when I save the file, it will create a backup. how could I specify the location for my backup file?

View 8 Replies View Related

Macro Do Backup File

Sep 27, 2002

Just thinking is there a macro that would do a backup of the opened file just by clicking an object?

View 9 Replies View Related

Saving Causes Backup Files To Form?

Apr 19, 2013

Whenever I make a change to any of my spreadsheets and click save, a backup is created in the same folder. A sample document is attached. Download it, make a change, then save it.

View 3 Replies View Related

Change Backup Option Folder

Oct 20, 2006

I know how to create a backup file for an excel file (General Options Menu in Save As dialog box, we have to tick the "Always create backup" check box). When we tick this option the backup file is created in the same folder. Can we specify the path were this backup file can be stored and updated each time when we save the main file.

View 4 Replies View Related

Backup Script Stop Working

May 15, 2007

I have trouble with the last part of a backup script, this part checks in subdir and should delete the oldest file (of 4) but since a while back it instead delete the new file saved earlier in the script and I dont know how to fix it. Here is the ...

View 5 Replies View Related

Pulling Of Data From Sheet1 To Sheet2 Or Any Backup

Oct 27, 2009

I have some data in sheet1 (as per attached sheet), every month i have to enter this data more than 1000 rows..i want a formula so that automatically this data should go to sheet2 and get a seperate report shape (as mentioned in sheet2) and also add a row below of each report in case ColumnA (Shipp) data is increased for some shipp name and also report heading shoudl be change according to columnA (shipp) and renumbering it.

View 3 Replies View Related

Disable Access To Excel Backup File In VBA?

Oct 7, 2011

Is there some sort of vba code that will stop excel from creating a backup copy of the export file from access?

XLApp.ActiveWorkbook.Close SaveChanges:=True

This code saves and closes the workbook, but it then creates a backup copy. I would like to enter some code so it stops making a backup file.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved