Capturing UserForms from a LegacyWorkbook


MDUF’s UserForm Capture Facility can capture UserForms created in Excel’s GUFEF, or created in any way really. If the UserForms exist and if they function properly in an Excel workbook, the UserForm Capture Facility can capture them.

Overview of the capture procedure

The mDialogBox titled "Choose the UserForms"
The mDialogBox titled “Choose the UserForms”

To capture legacy UserForms, load the CaptureWorkbook and the LegacyWorkbook into Excel. (See “Preparing the CaptureWorkbook for Legacy UserForm Capture”) Next, invoke the MDUF ribbon command This Project>Capture…. MDUF then presents the mDialogBox titled “Choose the UserForms”. It contains a ListBox showing the names of all the UserForms contained in LegacyWorkbook, omitting, of course, any UserForms in the CaptureWorkbook’s range Project!FormsNotToCapture. See “Preparing the CaptureWorkbook” for directions for specifying the LegacyWorkbook.

To select all UserForms in the ListBox, click the button captioned “Select All”. Omitted from the ListBox are UserForms specified in the range Project!FormsNotToCapture. Also omitted from the ListBox are any UserForms previously captured and which contain FALSE in the cell named Form.Capturable on the FormSpec worksheet that was created during a previous capture.

After capturing the UserForms from the LegacyWorkbook, the CaptureWorkbook contains one FormSpec worksheet for each captured UserForm. You can inspect the FormSpec worksheet for irregularities. If you find any minor issues, I recommend correcting them in the LegacyWorkbook if possible, and then re-capturing the UserForms.

The advantage of correcting the LegacyWorkbook instead of correcting the CaptureWorkbook becomes clear upon capturing the legacy UserForms for the second time. Any changes or corrections that were installed in the CaptureWorkbook are overwritten when you recapture the legacy UserForms. Revising the legacy workbook instead of the CaptureWorkbook ensures the safety of those revisions. 

References to other workbooks

Some legacy workbooks contain VBA projects that have references to other workbooks. References to Excel add-ins cause no problems for the capture process, provided that the referenced workbook is an Excel add-in and that the referenced workbook is installed and activated in your capture environment.

However, references to workbooks that aren’t Excel add-ins are another matter. The TargetWorkbooks and the TestWorkbooks obviously need to include those references if the UserForms generated from the captured data are to function correctly. And that implies that the referenced workbooks must be present in the Target environment and in the Test environment.

In the current version of MDUF, these references must be installed in TargetWorkbooks and the TestWorkbooks manually.

In some cases, if the environment is complex enough, building a Loader utility is a worthwhile investment. And you might want to install it as an Excel add-in. 

Dealing with changes in back-end code

One more thing. In some conversion episodes, the back-end code of the UserForm changes during the elapsed time of the conversion process, due to other ongoing work. During the capture, the checkbox “Capture code only”, if checked, causes MDUF to capture only the code and not the controls or their properties. This enables you to recapture the code without disturbing any of the other contents of the FormSpec worksheet. It’s a useful capability when you find an error or an enhancement that you’d like to make to the code after you start the conversion, but before the conversion is complete.