Run-time error '13':
Type mismatch
Type mismatch
-or-
Run-time error '9':
Subscript out of range
Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.
View products that this article applies to.
Sub ShowForm()
'Create an object called "x" to refer to UserForm1.
set x = VBA.UserForms.Add("UserForm1")
'Display the name of UserForm1.
MsgBox x.Name
'Show UserForm1.
x.Show
End Sub
UserForm1.Show
-or-
VBA.UserForms.Add("UserForm1").Show
Sub ShowForm()
'Open UserForm1 into memory.
Load UserForm1
'Count the loaded UserForms and subtract one
'because UserForm indexes start at zero.
x = UserForms.Count - 1
'Show UserForm1.
UserForms.Item(x).Show
End Sub