Call me crazy but would it be impossible to write a VBA function that converts a VBA module into VBScript?
To make it much easier, assume that any module I input is completely 'stand-alone' (i.e. it won't contain references to any global variables/constants nor will it reference any procedures outside of the module)
Also the converter function doesn't have to output a VBS file, I'd be satisfied with it returning a string (i.e. the string contains the VBA code in VBS format)
Thinking out loud - for starters, we'd need to deal with:
- VBS would have to create an Object to reference the Excel application.Then use this reference to refer to any Excel workbooks, built-in functions etc.
- VBA can have named arguments. VBS does not.
- Create constants in VBS for any Application Named Constants in the VBA code (e.g. xlDown)
Bookmarks