Here's a complete function using it. In this example, we'll get the cryptoJS libraries off the Internet, and encrypt and decrypt some messages using different kinds of encryption.
There are 3 ways to inject code into what you are going to run.
Once we've built up all the code needed, we are ready to compile and run
You always need this pattern when you are ready to execute
Here's the result -
You can get the test code and class from gitHub. It's been put there automatically - you can use Getting started with VbaGit to pull it into your workbook or just download it. Rememer to look at the dependency file for the Excel references required.
For more like this, see Google Apps Scripts snippets. Why not join our community , follow the blog, twitter, G+ .
Learning Apps Script, (and transitioning from VBA) are covered comprehensively in my my book, Going Gas - from VBA to Apps script, All formats are available from O'Reilly, Amazon and all good bookshops. You can also read a preview on O'Reilly
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation >