Reputation: 196539
We have a lot of VBA code in spreadsheets and a lot of time people save them to local drives. When we want to upgrade the spreadsheets we push a new version out to a shared drive but dont have any way of enforcing that people dont use the old versions of the spreadsheets.
Is there some best practice here to deploy vba spreadsheets so if someone loads an old version it wont open or will ask you to upgrade. It seems like this must be an issue for any custom solution so i would have through MS would have some solution here.
Does microsoft have a standard versioning / deployment solution for this or do i need to come up with some home grown solution (spreadsheet pings a database on startup to check version)
Upvotes: 6
Views: 957
Reputation: 6142
An easy solution would be:
I'm using a similar approach and it works fine.
Upvotes: 0
Reputation: 23520
If its just the VBA code you want to be able to upgrade one solution is to separate all the code into an XLA that sits on an accessible server. then the users Excel has an addin loader that gets the latest version from the server, or you could embed the loader in the workbook. There is a working example reversioning Addin Loader available at http://www.decisionmodels.com/downloads.htm
Upvotes: 1
Reputation: 37620
Upvotes: 0
Reputation: 21684
Add a custom property to the workbook, such as a GUID, Integer, Date, or whatever you need. On startup, check the value and determine if VBA should continue or whatever implementation you decide. Usually, I open the "shared" latest version of the document and inspect its custom property. If user is not using latest version, display a message prompting the user to get the latest version. This is usually good enough. I have done this for years with great success for Access, Word, and Excel VBA.
One real problem is people who ignore the prompt to update. They will do this because they fear losing data, bugs in latest version, and so on. You need to address their concerns and not try to "lock" them in to your "solution" to this problem. I strongly recommend you always provid a means of "importing/upgrading" data to latest version of workbook.
Fairly simple to implement. If you address the above mentioned problem effectively, people will start to trust the "prompt" and you will find this is a really simple and effective solution.
If you workbook is tied to a database, it gets a little more complicated. Generally, you do not allow the user to maintain the data outside of the database. When they want to modify the data, you generate the workbook for them. After they are done modifying data, you import the data. (The workbook is saved for "backup" purposes or the user can maintain a copy of the workbook for reference or an archive.) This has the advantage of eliminating the need to maintain document version since the document is "virtual".
Upvotes: 0
Reputation: 65506
Though I've not done this. I've see people do something similar where they store the code in dlls in the database, and then verify that the local ones are the same on start up.
Upvotes: 0