How do you backup?

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

How do you backup?

Post by LisaGreen »

Hello!

I'm wondering how people backup their VBA code.

Any contributions appreciated.

TIA
Lisa

User avatar
HansV
Administrator
Posts: 78393
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How do you backup?

Post by HansV »

I'm a simple guy, I just regularly backup my files (workbooks, documents, databases, ...) whether they contain VBA or not. I don't use a version control system or a code repository or something like that...
Best wishes,
Hans

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: How do you backup?

Post by LisaGreen »

Thank you Hans!

Lisa

User avatar
Doc.AElstein
BronzeLounger
Posts: 1499
Joined: 28 Feb 2015, 13:11
Location: Hof, Bayern, Germany

Re: How do you backup?

Post by Doc.AElstein »

Hi Lisa,
Almost all my VBA code is in Excel Files and a few in Word Files. So most gets stored in them . So mostly, how I store my VBA coding and Files is the same.

Three parallel system I have. The first one is probably the only one sane enough for me to give any detail on here, although the third one is OK for limited private use. I doubt anything I do would be too appropriate for a professional.
_1)
I try and do as much of my important stuff as possible on one main computer which almost permanently has a 1000GB hard drive thing permanently connected to it. I try to keep as much as possible on that hard drive and work from that as much as possible. ( It is almost full. I am not sure yet what to do when it is full). By my standards, things are organised fairly well on that hard drive. Occasionally, but as rarely as possible, that hard drive “travels” with me.
I have a second similar hard drive that everything gets copied to once in a while. ( I sometimes do that semi intelligently... If I am intelligent enough to remember what things I did since the last copy, then I just replace those relevant folders )
_2)
This is the most bullet proof actually. I suppressed my messy instinct a life long in order to keep my house tidy . Since I got computers I live it out there. Everything gets constantly saved all over the place. I never throw anything away. If the world internet died and my house blow up, I expect in the rubble I would be able to dig out enough to painstakingly get everything from somewhere.
_3)
I have a few very important files used by me and my wife that are updated regularly but at random times. We keep those files stored in all the usual places, but have a rule that in addition , the most up to date file is in a cloud sharing place.
If either of us wants to update it, then we have a simple rule ( which I adhere to and she usually doesn’t and so she makes a mess that I enjoy sorting out). The rule is that the version from the cloud is downloaded, that is the one always updated, and then that is saved and re uploaded to the cloud as soon as possible.
( It hasn’t occurred yet that by chance both of us tried to update anything at the same time. I doubt it would cause a major tragedy if it did ).

_._________________

( I have been starting to store codes on their own in a few ways last year , but I am still experimenting a bit with that …)

Alan
I am having difficulty logging in with this account just now.
You can find me at DocAElstein also

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: How do you backup?

Post by LisaGreen »

Hi everyone,

I'm a little disappointed with only getting replies from two people.

I'm going to cross post this elsewhere and come back here of course and mention where.

Lisa

http://www.vbforums.com/showthread.php? ... ost5347183" onclick="window.open(this.href);return false;

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: How do you backup?

Post by LisaGreen »

Thank you Alan.

User avatar
StuartR
Administrator
Posts: 12601
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: How do you backup?

Post by StuartR »

I don't do much VBA programming nowadays, but I do use a few different approaches to backing up my files.
  • I use Allway Sync to synchronise folders on my laptop and my PC. Any edits I make on either computer are copied to the other a few minutes later.
  • I use Acronis TrueImage to backup any file that I edit on my laptop to the Acronis cloud. This is a Sync backup that copies files to the cloud very soon after they are created/modified. It keeps multiple copies of each file so I can easily restore an earlier version if I do something really stupid.
  • I also use Acronis to create full image backups of every disk every night. So I can do a complete recovery if a disk drive fails or I get a major software problem.
StuartR


User avatar
kdock
5StarLounger
Posts: 720
Joined: 21 Aug 2011, 21:01
Location: The beautiful hills of Western North Carolina

Re: How do you backup?

Post by kdock »

Hi Lisa. I keep folders for client work on my main PC. I keep code in the template for which it is intended.

I make three backups. 1) A compressed system image at long intervals. 2) A compressed backup of all data more often (I have been careful to identify all data files I have sprinkled around my PC), and 3) I do a plain file copy of changed files in specified folders every day at noon.

I use NovaBackup for all three. I have a networked Synology server with two 1 Terabyte SSDs. They mirror each other so if one fails, the other has the backup. Since my PC has a SSD, all backups run really fast.

I used to keep a simple access database with blocks of code, what it did, what resources needed to be specified, and such like, but found it was very difficult to motivate myself to keep it updated. I still have it but haven't added anything to it in some time. I haven't referred to it in some time, either.

I try to make up for the lack of formal notes on the code by making sure the code itself has any information I need.

Hope that helped. Kim
"Hmm. What does this button do?" Said everyone before being ejected from a car, blown up, or deleting all the data from the mainframe.

User avatar
AlanMiller
BronzeLounger
Posts: 1545
Joined: 26 Jan 2010, 11:36
Location: Melbourne, Australia

Re: How do you backup?

Post by AlanMiller »

LisaGreen wrote:I'm wondering how people backup their VBA code.
Since you're asking specifically about code, are you looking at ways of saving copies of VBA projects?
If so, there are numerous methods floating around to export to .bas, .frm, .cls files. Like this one used for MSAccess:

Code: Select all

Public Sub ExportVBAComponents()

  Dim wbPath As String
  Dim vbComp As Object
  Dim exportPath As String

  wbPath = ActiveWorkbook.Path

  For Each vbComp In ActiveWorkbook.VBProject.VBComponents
    exportPath = wbPath & "\" & vbComp.Name & Format$(Now, "_yyyymmdd_hhnnss")

    Select Case vbComp.Type
        Case 1 ' Standard Module
            exportPath = exportPath & ".bas"
        Case 2 ' UserForm
            exportPath = exportPath & ".frm"
        Case 3 ' Class Module
            exportPath = exportPath & ".cls"
        Case Else ' Anything else
            exportPath = exportPath & ".bas"
    End Select

    On Error Resume Next
    vbComp.Export exportPath
    On Error GoTo 0
  Next

End Sub
The code above will export all the VBA components/modules in your ActiveWorkbook to the same location as your workbook. It will use the component name as part of the file name and will add a timestamp. Since you have more than 100 modules, you'd better change the export path to include a subfolder to group them all together in one place.

NOTE: For this to work, you need to select Options>Trust Center>Trust Center Settings...>Macro Settings>Trust access to the VBA project object model. Otherwise you get some random error in the For Each line. You can tick that option off afterwards if you're worried about it.

Alan

EDIT: I should have added that the above formats, being effectively just plain text files, have the added advantage of portability and "universality" across various versions, systems etc. and reuse in new projects. So they carry potentially more advantage as backups than just copies of the original complete files.

User avatar
HansV
Administrator
Posts: 78393
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How do you backup?

Post by HansV »

Hi Alan, that code is for Excel (it refers to ActiveWorkbook), not Access.
Best wishes,
Hans

User avatar
AlanMiller
BronzeLounger
Posts: 1545
Joined: 26 Jan 2010, 11:36
Location: Melbourne, Australia

Re: How do you backup?

Post by AlanMiller »

HansV wrote:Hi Alan, that code is for Excel (it refers to ActiveWorkbook), not Access.
Clearly correct. I cited it as just using export as a method of VBA backup, as opposed to complete file backup ... since I thought that might be what the OP was seeking.
The thread I pointed to was a bit convoluted.

Alan

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15585
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: How do you backup?

Post by ChrisGreaves »

LisaGreen wrote:I'm wondering how people backup their VBA code.
Hello Lovely Lisa!
(edited to fix a typo from "Lonely" to "Lovely")

I use a versioning system.
Like Hans I do regular (nightly) backups and weekly backups to a master backup drive.

All my applications receive a five-letter name with a three-digit suffix.
Hence "Infor440.dot", "McGhi016.dot", and "MRUse589.dot".

A macro button on my Normal.dot toolbar "VBAStartUp" opens a template from the Word\Startup folder by default, and then opens the VBE AND maximizes the VBE window.
A second macro button "VBEUpUser" includes a facility to increment that three-digit suffix. (as well as browsing to any folder on my system)

So, when I am instituting a significant change to an application, I increment the three-digit suffix which means I have an audit-trail of earlier versions. I can always fall back to an earlier version that was Working Just Fine(TM) before I started changing things.

I use the three-digit suffix to identify version changes in a WhatFAQ.doc; I keep a WhatFAQ for every application, and I have attached a PDF of a WhatFAQ for your examination.

I am sorry to hear that you were disappointed to receive replies from only two people. To cure you of that, I am attaching too a TXT file with the top-level code of the two macros I mentioned.

I hope that this cheers you up!

Cheers
Your Friend
Chris
You do not have the required permissions to view the files attached to this post.
There's nothing heavier than an empty water bottle

LisaGreen
5StarLounger
Posts: 964
Joined: 08 Nov 2012, 17:54

Re: How do you backup?

Post by LisaGreen »

Thank you Chris!!

Lisa