How to Compare Controls on the Visual Basic Forms

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:

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:

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:

  • [S] - code module which corresponds to worksheet
  • [B] - "ThisWorkbook" code module
  • [FC] - controls on the visual basic form
  • [F] - code module of the visual basic form
  • [C] - class module
  • If there is no prefix - this is usual code module

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.

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:

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.