For the complete documentation index, see llms.txt. This page is also available as Markdown.

Convert to VB.NET

Convert to VB.NET rewrites a formula written in VBScript or PowerShell as a VB.NET formula, so that it also works on the web and in the 64-bit version. The button is available in the Script Editor when the Language is VBScript or PowerShell.

Nothing is saved by the conversion. You test the converted formula and save it as usual; Close without saving keeps the original.

Convert a formula

  • Open the formula in the Script Editor and press Convert to VB.NET.

  • The Convert to VB.NET window shows the original formula (Original (VBScript) or Original (PowerShell)) and the converted one (Converted (VB.NET) - this goes into the editor) side by side.

  • What to check lists the points of the conversion with their lines: Fix (must be corrected before VB.NET will save the formula) first, then Check (worth a look) and Note (information only).

  • The window's title shows how many are left, for example Convert to VB.NET - 0 to fix, 1 to check.

Names that are not fields

If the formula uses a name that is not a field of this screen - often a spelling mistake or a field that was renamed - it is listed under Names that are not fields of this screen - choose, then Convert again.

  • Select the name and pick what to use in Use instead:

    • for a name the formula only reads: the right field, or 0;

    • for a name the formula stores a value in: the right field, or (keep as a working variable).

  • Press Convert again to see the result.

Other options

  • Remove lines commented out with '' (old code) leaves out old lines that were already switched off in the original.

Use the converted formula

  • Press Use converted script. If points marked Fix are left you are asked: The converted script still has points marked Fix. VB.NET will not save it until they are corrected in the editor. Put it in the editor anyway? (the default answer is No).

  • The editor shows the formula with the Language set to VB.NET and the message The script is now VB.NET. Press Watch to test it, then Save. Nothing has been saved yet - closing without saving keeps the original script.

  • Test it with Script Watch and press Save.

  • Cancel closes the window and leaves the editor as it was.

What the conversion does for you

  • A line at the top records the date of the conversion, and the original formula is kept at the bottom as notes, so you can always see what it was.

  • A division by zero gives 0 for that value. Before, the whole formula stopped and its values showed 0.

  • A PowerShell ForEach that goes through a variable column group (see Script Editor) becomes a VB.NET For Each. Each column's Value is read as a number with Val, and a Note says so; a blank value counts as 0.

  • In a VBScript formula, the Value of a column in a variable column group is also read as a number.

  • If a VBScript formula uses a whole variable column group where one value is expected, the line is listed under Fix and marked NOT_CONVERTED_ followed by the group's name, until you rewrite it - go through the group with For Each, or pick one column.

Check after converting a variable column group

  • PowerShell compared a column's value as text, so a check such as -gt 0 also let a negative value through. The converted formula compares numbers and leaves negative values out. If a group can hold negative values, compare a few results before saving, and change > 0 to <> 0 if they should be counted.