I am unable to find this information on the site using the search
feature. And I have seen similar post On C# into Java and VBA into C# in this post
I raise this question because I think it's at least partially achievable if not all, and this would be a useful guide for others to do the conversion. Example question found on the net: here
Can ALL VBA be converted into VBS after some processing (Code changes)?
If not, what type of VBA program cannot be converted?
If yes, is there a vba program or any tools to do that automatically? If not, can someone kindly provide a full list of conversion rules from VBA to VBS? (I would like to write a VBA program to automatic this process if possible)
I am only aware of the following Rules
(Please correct me if I am wrong)
- Remove the type of a declaration Statement
VBA: Dim a as string
VBS: Dim a
- VBS has no enumeration list (Named Constants)
VBA: Xlup
VBS: -4162
- You cannot use
redim someArray( A to B)
syntax in VBS (VBS always start with 0 index)
VBA: Redim someArray( 1 to 10)
VBS: redim someArray(10)
- You cannot specific iterator in a for loop in VBS
VBA:
For i = 1 to 10
'do something
next i
VBS:
For i = 1 to 10
'do something
next
Always need full qualified range in VBS (Just a demo.)
VBA:
range("A1") = "Testing"
VBS:
ExcelObj.Workbooks(1).Worksheets(1).Range("A1") = "Testing"
- VBS cannot use VBA Collection type (Or Am I Not using the correct CreateObject?)
P.S. I am aware of this list and this list
I would appreciate any help, thanks in advance, and sorry for the long question._.
EDIT: I am working on a script myself, will update when I finish