├── README.md
├── VBAToJavaScriptTranslator.html
└── vb2js.js
/README.md:
--------------------------------------------------------------------------------
1 | # VBA-to-JavaScript-Translator
2 | This translator is intended to be used as an educational tool to help VBA developers get familiar with JavaScript.
3 |
4 | The code for this tool is based on regex examples found from multiple sources in forums and online. Sorry to say...I did not keep a record of all the sources I leveraged. Just know that people smarter than I am provided the basis for most of the code found here. I simply adjusted what I needed and slapped it all together into a single utility.
5 |
6 | As with most translation tools, this tool will NOT perform a 100% complete translation.
7 | It is designed to cover common constructs in VBA (enough to get you started).
8 |
9 | The idea is to enter a basic block of VBA code (be sure to include your Function/Sub wrappers) and see how the syntax would look in JavaScript. It's best if you first try something simple then progress into more advanced IF statements, loops, comparison operators, Select Case switches, etc.
10 |
11 | Currently, this translator works with:
12 | * Both Functions and Sub Procedures
13 | * Variable Declarations
14 | * Basic IF THEN Statements
15 | * SELECT CASE Statements
16 | * Most Comparison Operators
17 | * Basic FOR x TO y Loops
18 | * Most variations of DO LOOPS
19 | * Basic MSGBOX calls
20 |
21 |
22 | Known Issues:
23 | This tool currently does NOT accurately translate
24 | * Built in VBA functions
25 | * References to Office Objects
26 | * WITH Statements
27 | * STEP Constructs in FOR Loops
28 | * FOR EACH Loops (in fact these cause the tool to return nothing at all. I'm still working out why that is)
29 |
30 | I offer the source code up to anyone interested in helping make enhancements to this tool in order to develop a more robust utility for the VBA community.
31 |
32 | See working tool here: http://www.datapigtechnologies.com/VBAToJS/VBAToJavaScriptTranslator.html
33 |
--------------------------------------------------------------------------------
/VBAToJavaScriptTranslator.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 | This translator is intended to be used as an educational tool to help VBA developers get familiar with JavaScript.
20 |
21 | This tool will NOT perform a 100% complete translation. It is designed to cover the most used constructs in VBA (enough to get you started).
22 |
23 | Start by entering or pasting a basic block of VBA code (be sure to include your Function/Sub wrappers).
24 |
25 | Review how that code looks in JavaScript. Next, try increasingly more advanced code examples (loops, if statements, etc.).
26 |
27 | Happy Learning! -Mike Alexander datapigtechnologies.com
28 |