Basic UserForm Properties


Basic UserForm properties include properties of the UserForm itself, and some common properties of many of its controls.

The UserForm Properties block of a FormSpec worksheet

The "UserForm properties" block of the FormSpec worksheet
The “UserForm properties” block of the FormSpec worksheet. Here you can set properties of the UserForm itself, and default properties for many of its controls.

The top section on the left side of a FormSpec worksheet is the UserForm Properties Block. It’s titled “UserForm properties”. Some of the properties you can set here are properties that affect all controls on the UserForm. In addition, some properties in this block support MDUF management and operations.

On the right-hand side of the FormSpec worksheet, beside the UserForm Properties Block, is the Control Properties Block. It is in this block that you specify controls for your UserForm. At the bottom of the Control Properties Block is a section that holds some of the properties of the UserForm itself, including its name, position, size, caption, and colors. We refer to that section as the “Form record”.

The captions beside each parameter cell in UserForm Properties Block are the defined names of the respective cells. For example, the cell with the caption “Targets” has a defined name of “Targets”. These defined names are useful for writing macros that alter the cell values programmatically. See the section, “Generating UserForms programmatically”.

For items that specify linear measure, the units are twips. One twip is 1/20 of a point. A point is 1/72 of an inch. So a twip is 1/1440 of an inch. 

The properties

Form.Font

The cell captioned “Form.Font” holds the name of the font used by the UserForm and those of its controls for which fonts aren’t otherwise specified. If you don’t specify the font of a given control, MDUF uses the font specified in Form.Font. If you don’t specify Form.Font, MDUF uses the font specified in Project!Form.Font. (See “Project Properties”) If you don’t specify a font on the Project worksheet, MDUF uses the font called Lucida Grande.

Form.FontSize

The cell captioned “Form.FontSize” is the size of the font (in points) used in the UserForm by controls for which you haven’t specified a font size. It defaults to 10 points. If you don’t specify the font size of a given control, MDUF uses the font specified in Form.FontSize. If you don’t specify Form.FontSize, MDUF uses the font size specified in the cell Project!Form.FontSize. (See “Project Properties”) If you don’t specify a font size on the Project worksheet, MDUF uses the font size of 10 points.

Form.Pad

The cell captioned “Form.Pad” holds the minimum amount of spacing, in twips, between the edge of the UserForm and any controls within it. If this cell is blank, MDUF uses the value in Project!Form.Pad.

Form.Version

The cell captioned “Form.Version” contains a version string that you can (optionally) define for your UserForm. This string is output in the code pane of the UserForm. It might be useful for debugging, for customer support, and maintenance. It isn’t visible to your users unless they choose to view (and you allow them to view) the code pane of your UserForm.

Form.Status

This cell contains the status of this UserForm. Status can be Active, Inactive, or Testing. These three settings control the behavior of the Ribbon commands for generating UserForms. If Form.Status is Inactive, then the MDUF generator does not generate the UserForm even if called upon to do so. You can use the Testing status to control the name of the Target workbook using Excel’s CHOOSE worksheet function, for example.

Form.IsTemplate

If True, then the worksheet is a template worksheet, and the UserForm generator doesn’t produce a UserForm from it. MDUF is distributed with one template worksheet, named “T.Generic”, which is mostly plain vanilla. But you can set up your own templates. See “New FormSpec worksheets and new templates”.

TemplateName

If the worksheet is a template worksheet, this cell holds the template’s name. If the worksheet isn’t a template worksheet, this cell holds the name of the template worksheet from which this worksheet was derived. You’re free to enter whatever you like in this cell, but it’s intended to be modified only by a template author or worksheet author.

This cell is useful for tracking which FormSpec worksheets have been derived from which template worksheets. In a large project, when you make a change to a template, this cell can tell you which FormSpec worksheets might also require compatibility modifications.

Targets

The cell captioned “Targets” holds either (a) the name of the workbook that hosts the UserForm to be generated, or (b) the pathname of that workbook relative to the Project workbook, or (c) the absolute pathname of the target workbook. Although the contents of this cell can be complicated, normally you would use the full pathname of the hosting workbook if that workbook resides in a folder different from the folder of the Project workbook, or if The target workbook isn’t loaded into Excel. If the Target workbook and the Project workbook are in the same folder, then it’s sufficient to use the Target workbook filename. See “Specifying target workbooks”.

CodeSource

CodeSource must be one of Target UserFormThis Worksheet, or Code Generator. The value determines where MDUF looks for back-end code when it generates the UserForm. See “Dealing with Captured Legacy Code”.

Form.ShowMacro

The name of the macro in the target workbook that shows the UserForm.

Form.Capturable

Form.Capturable must be one of TRUE or FALSE. If TRUE, then when you capture the legacy UserForms of a legacy workbook for a second or nth time, MDUF recaptures this UserForm. If FALSE, MDUF skips over this UserForm. Use the FALSE setting when you’ve made adjustments to the FormSpec worksheet after capture, and you don’t want MDUF to overwrite your previous work.

ColumnBoundaries

Set to a string that species the column widths of controls on the UserForm. See the section, “Automated Assignment of the TabIndex Property”.

Ctrl.Width

The cell captioned “Ctrl.Width” holds the default width in twips of all controls in the UserForm. You can leave this cell blank if (a) you specify the widths of controls in their section of the FormSpec worksheet, or (b) you specify a default width for all controls on the Project worksheet of the Project workbook, or (c) you want Excel to determine control widths automatically.

Ctrl.Height

The cell captioned “Ctrl.Height” holds the default height in twips of all controls in the UserForm. You can leave this cell blank if (a) you specify the heights of controls in their section of the FormSpec worksheet, or (b) you specify a default height for all controls on the Project worksheet of the Project workbook, or (c) you want Excel to determine control heights automatically. 

Ctrl.Margin

The cell captioned “Ctrl.Margin” holds the minimum amount of spacing between controls, in twips. Controls that are close to the edge of the UserForm use the larger of the UserForm pad (Form.Pad) and the control margin as the spacing between the control and the edge of the UserForm.

Ctrl.ForeColor

The cell captioned “Ctrl.ForeColor” holds the specification (in Hex) of the ForeColor of all controls that don’t specify their own ForeColor. If this cell is empty, MDUF uses the color specified in Project!Ctrl.ForeColor.

Ctrl.BackColor

The cell captioned “Ctrl.BackColor” holds the specification of the BackColor of all controls that don’t specify their own BackColor. If this cell is empty, MDUF uses the color specified in Project!Ctrl.BackColor.

Ctrl.BorderColor       

The cell captioned “Ctrl.BorderColor” holds the specification of the BorderColor of all controls that don’t specify their own BorderColor and which also have a BorderColor property (some do not). If this cell is empty, MDUF uses the color specified in Project!Ctrl.BorderCcolor.