Using the modules from Automatic documentation, here's how to create a skeleton Google Apps Script Module directly from VBA modules or classes. It will also create basic JSDOC markup for documenting your new GAS module. You'll find all you need in the cDataSet.xlsm workbook in the classSerializer module. For automatic updating, use the same manifest as automatic documentation.
First you have to set up your Excel workbook so that the code can be read by VBA, as described in Automatic documentation. A small module like the one below, will then create a GAS skeleton module in the clipboard, ready for pasting into the GAS IDE. In this case we are taking one class called "cStringChunker". You can do many modules/classes at once separated by commas
Here's a small module with the starter skeleton pasted in.
In Google Apps Script, we can create psuedo classes. VBA classes are converted as below.
Optional arguments have their name changed, with an opt... prefix. A small piece of code is generated to populate the argument with their default values if they are not given. In other words the construct
When translating to GAS, it's useful to have the original code as a block comment. Aside from being useful to refer to it in the GAS code, it often needs minimal editing (especially when using Google Apps Script VBA equivalents library). You can ask for the original code to be included as code block, like this - the True means to include the code.
This gives the rather more verbose
So far we've used the clipboard to transfer between VBA and GAS. I find this much more convienient, but you may want to create a file instead. A small tweak will write the content to a file instead
You'll find all you need in the cDataSet.xlsm workbook in the classSerializer module. For automatic updating, use the same manifest as automatic documentation.
Here's the main code for doing this - or you can find it in the gist library noted below.
Translating code is beyond the scope of what I'm trying to achieve here, but this gives good start for the boring parts. I'll see how else this can be enhanced over time.