Compare Controls on the Visual Basic Forms

Using xlCompare to compare controls on the VBA Forms in the Excel workbooks.

How xlCompare works with forms in the Excel workbooks

This topic contains a brief description how xlCompare works with Forms and Controls in the Visual Basic Project.

When you open workbook in the xlCompare, it doesn't show you Visual Basic forms and modules, you should switch to the Visual Basic Project View using VB Project button:

xlCompare - Visual Basic Project switch

Now you see contents of the Visual Basic Project of your workbook. Look in to the Tab Control on the bottom of the main window:

xlCompare - Visual Basic Project Tab

This tab contains all modules and forms in the Visual Basic Project and should be used to navigate between them. There is no way to organize all items in the tree-like form, as Microsoft Excel, so we are using prefixes to indicate what this item displays:

All code modules is just a set of text lines, so window which displays VBA Code has nothing special.

Form controls are organized into tree-like form. Root node represent entire form. Subitems - controls contained on the form. Controls like a frame control, which can contain controls itself, have subitems in this tree.

xlCompare - Controls on the Visual Basic Form

Every node in this tree displays its attributes, like "Position", "Size", "Caption", ...

When you compare workbooks, VBA Forms and Controls are also compared and results look like this:

xlCompare - VBA Forms Comparison results

This report contains added\deleted and changed controls. If you have controls with changed attributes, for example control was moved and Left and Top attributes are changed, this is also reflected in the comparison report.