Allow updating file from GitHub
Closed this issue · 5 comments
As this add-in gets more polished, it will be useful for it to update itself from the latest release on GitHub. This will prevent folks from having to check this site regularly. This is possible from VBA and the add-in itself.
I've got some code coming that will address this. It downloads the latest version from GitHub and then runs a VBS script that it creates to overwrite the current file with the new one. This seems to be the cleanest way to ensure that the add-ins list is not ruined by the new version. Not sure how that will be viewed in some group policy settings though.
For now, this will work on a "click and update" scheme with automatic checking coming in the future.
Once a new release is in place, I will then tap into the GitHub API to determine the current version and do a comparison. The only remaining piece is to determine how to store the current version in the file. A simple constant or string would be fine as long as it gets updated.
I'll put this code in a new branch to start.
This is possible in VBA? Or do you need to execute from other libraries from within VBA? Would windows, mac, etc need to be different?
Yea, it's (roughly) possible from VBA. It relies on using VBA to create a VBS script that be executed outside of VBA.
The VBA part downloads the new xlam file from Github and then creates/starts the VBS script. The VBS script does the actual business of deleting the old xlam and renaming the recently downloaded one. If it all works, then the update is fairly transparent and no changes are needed to the add-in list since the previous file was just replaced.
It uses a couple of Scripting Objects to download that I think are standard on a Windows install. No idea what happens on Mac though. I don't have one to test with (yet) so I don't know the quirks of VBA on Mac.
I'll get the code posted shortly and you can take a look/try it out.
I hate everything about excel on mac, but I am pretty happy they finally made 2016 be the same across platforms.
I think #58 completed this
Yes, this is complete. I expect future issues here though. :)