How to add references by guid

In Which VBA references you are using we looked at how to get details about references active in a project. Let's look at how to add those references to a project using code. This approach is needed in How to update modules automatically in VBA since references are dependencies that can be automatically updated in the same way as code. 

Here is code, with a couple of example references being added, downloadable here. This is in fact the code needed to add the references needed by the bootstrap code in  How to update modules automatically in VBA.  

Learning Apps Script, (and transitioning from VBA) are covered comprehensively in my my book, Going Gas - from VBA to Apps script, available All formats are available now from O'Reilly,Amazon and all good bookshops. You can also read a preview on O'Reilly

If you prefer Video style learning I also have two courses available. also published by O'Reilly.
Google Apps Script for Developers and Google Apps Script for Beginners.

For more tips like this see Get Started Snippets

In the meantime why not join our forumfollow the blog or follow me on twitter to ensure you get updates when they are available.