Compare VBScript and Visual Basic code

A Visual Basic module where a function and its variables were renamed. Paste your own .vbs, .vb or VBA code to compare it. Tips for VBScript

Original
0 lines
Drop to load into original
Changed
0 lines
Drop to load into changed
−0+0
Original
Changed

About this VBScript comparison

Old VBScript automation and VBA macros are often copied and edited by hand, so it is hard to tell which copy is current. Comparing two versions shows every changed line and marks the names and values that differ.

The same works for VB.NET code, which you can pick in the syntax menu.

What changed in this sample

  • AddNumbers(a, b) was renamed to CalculateTotal(x, y).
  • num1, num2 and sum became a, b and total, set to 12 and 18.
  • The If threshold went from 15 to 20 and the console messages changed with it.

Tips for comparing VBScript

Ignore case
Visual Basic is not case sensitive. Turn on Ignore case so Dim and DIM are treated as the same.
Compare VBA macros
Export each module from the VBA editor (File › Export) or copy its code, then paste both versions here.
Windows line endings
Scripts saved on Windows use CRLF. Line endings are never counted as changes.
Keep both copies
Save the comparison in the browser so you can come back to it while you merge the scripts.

How to compare VBScript online

  1. Paste the older version into Original and the newer one into Changed, or open a file on each side.
  2. Check that the syntax menu says VBScript, then pick split or unified view.
  3. Step through the changes with the arrows or Alt ↓, and use Settings for options such as ignoring blank lines.
  4. Save the comparison in your browser, share a link, or download it as a .diff, HTML or PDF.

VBScript comparison: questions

Can I compare Excel VBA macros?

Yes. Copy the code of each macro into the two panes. The workbook itself cannot be compared, only the code.

Is VB.NET supported?

Yes. Pick VB.NET in the syntax menu for .NET code, or VBScript for .vbs files.

Does it run the script?

No. The script is only compared as text.