01-02-24 05:28 PM
I am trying to create code stages to extend excel functionalities in blue prism MS excel vbo.
In order to generate the code for specific functions like highlight cell, filter column, etc. the code available online in ms documentation is in VBA.
So I am not able to convert it into vb.net!
I need advice how to learn to convert the excel vba code into vb.net , please share any method to learn to convert the code like tutorial, books, etc.
01-02-24 09:51 PM
1. Write out the code in VBA and step through the routine in the Excel VBA Editor.
THEN:
2. Remove all uses all the Set keyword.
3. Replace all Excel enumeration terms with the Int32 value (so e.g xlValues might be -4192). You can do this by running to a breakpoint in Excel and then hover over all such enum values.
4. Always use parentheses for function calls and enclose arguments.
5. Get rid of any Call keywords.
6. Always Use the Return keyword to return a function output, instead of assigning the value to the Function name.
7. Consider the better Boolean operators in VB.NET (i.e The If operator, AndAlso, OrElse)
8. Arrays don't use LBound and UBound - instead use Array.GetUpperBound, and GetLowerBound
9. You can only create 0-based Arrays easily in VB.NET, unless you use the Array.CreateInstance overload that allows other bounds.
02-02-24 12:01 AM
To my knowledge there is no code converter for VBA to VB.net.
Check below threads for some useful suggestions for converting VBA to vb.net