Properties Window

The Properties window has two tabs.
The Alphabetic tab displays all the properties in alphabetical order
The Categorized tab displays the properties grouped into logical categories.
Both tabs contain the same properties.
To change a property just click it and specify a new value.
If you select more than one control then the Properties window only displays the properties that are common to both.
The Image control's Picture property is a bit different because you either select a graphic file or you can paste a graphic directly from the clipboard. Using (Ctrl + V).


Tag Property

Every userform and control has a tag property.
This property does not represent anything specific and is empty by default.
You can use this tag to store your own information in.
For example you may have a series of textboxes on a userform.
The user may be required to enter text into some of the textboxes but not all of them.
You could use the tag property to indicate if a textbox is required to be filled in or not.


For Each objControl In UserForms.Controls 
   If TypeName(objControl) = "TextBox" Then
      If objControl.Tag = "Required" Then

      End If
   End If
Next objControl

All the controls on a userform make up the collection Userform1.Controls.
There is not a collection for each type of control so you must use the TypeName function to determine the type of each control.


Common Properties

Depending on the type of control will depend on the methods and properties that are available.
There are however some properties that are common to all types of control

ControlTipTextTool tip text to appear when you hover the mouse over the control
ControlSourceLinks the control to a cell on a worksheet
DefaultTrue if the control is to be selected when the Enter key is pressed
Enabled 
Height 
HelpContextID 
Left 
TagInvisible tag that can be used for control management
Top 
VisibleTrue if the control is visible when the userform is displayed
Width 

Common Methods

Depending on the type of control will depend on the methods and properties that are available.
There are however some properties that are common to all types of control

SetFocusMoves the input focus to that control


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext