Complete the code to create a UserForm named 'MyForm'.
Dim [1] As UserFormThe default UserForm name is usually 'UserForm1' when you add a new form in VBA. However, if you want to create a UserForm named 'MyForm', you declare it as 'MyForm'.
Complete the code to show the UserForm named 'UserForm1'.
[1].ShowTo display a UserForm, you call the Show method on its name, which is 'UserForm1' by default.
Fix the error in the code to add a TextBox named 'txtName' to the UserForm.
UserForm1.Controls.Add "Forms.TextBox.1", "[1]"
Control names are case-sensitive and should match exactly. 'txtName' is the correct name format.
Fill both blanks to set the caption of a CommandButton named 'cmdSubmit' to 'Submit'.
UserForm1.[1].[2] = "Submit"
The property to set the text on a button is Caption, and the button's name is 'cmdSubmit'.
Fill all three blanks to create a dictionary of TextBox names and their values from the UserForm.
Dim values As Object Set values = CreateObject("Scripting.Dictionary") For Each ctrl In UserForm1.Controls If TypeName(ctrl) = "[1]" Then values.Add ctrl.[2], ctrl.[3] End If Next ctrl
This code loops through controls, checks if each is a TextBox, then adds its name and text value to a dictionary.