Loading VBA code into Excel automatically from gitHub

Unlike Google Apps Script, which has a fine cloud based library capability, sharing and keeping code current for non-professional developers who use VBA is challenging. The use of add-ins for finished products with specific capabilities is ok, but what about sharing those useful functions either with others, or between workbooks, and even worse, keeping them up to date as new features are added. Since code is linked to and stored in workbooks, sharing code without sharing workbooks has always been complex, particularly where there are dependencies

Cloud based VBA?
Not exactly, but if all reusable code is kept as a Gist on github then the latest version is always accessible. So all we need is a way to organize it and get it into VBA.

gistThat is a method, using a small bootStrap module to get started (itself a Gist), you can get all the modules and classes associated with a particular capability automatically loaded into your vbProject, and keep them updated.

How does it work?

  • Create a Gist of the code you want to share or access from anywhere. Here’s an example.
  • Load the 
    gistThat bootstrap module into your project.
  • You create a manifest of all the gists you need for a particular purpose ( a tool to automate  this is included in the gistThat bootstrap module). The manifest is itself a gist.
  • You reference one or more manifests by their Gist ID in your project, and the latest code is loaded from the cloud into your project – like this,.

Function gtExample
  gtDoit “3414394” 
End Function 

The motivation behind this capability is to see if there is a way to share VBA code more publicly and more easily. If you have some code you’d like to share (even with yourself), take a look at how in more detail here. I will be creating a directory of useful manifests once this beds down. If you have any questions, please contact me on our forum or comment on this blog.

Author: brucemcp

Leave a Reply

Your email address will not be published. Required fields are marked *