C
Cooz
Hi everyone,
My template contains three UserForms: UserForm1, UserForm2 and, indeed,
UserForm3. In addition, it has this sub:
Sub ASub()
Dim aForm As UserForm
Load UserForm1
Load UserForm2
Load UserForm3
MsgBox UserForms(1).Name
For Each aForm In UserForms
If aForm.Name = "UserForm2" Then Exit For
Next
Call AnotherSub(aForm)
End Sub
When I step through the code, it displays 'UserForm2' in the MsgBox.
Stepping further, the part 'If aForm.Name = "UserForm2" Then' results in
run-time error 438: "Object doesn't support this property or method".
Now why is that? And how can I refer to UserForm2 to pass this particular
form as an argument to a sub? UserForms("UserForm2") is not allowed, and
performing a test beforehand on the name of the UserForm apparently is not
allowed either.
Thank you,
Cooz
My template contains three UserForms: UserForm1, UserForm2 and, indeed,
UserForm3. In addition, it has this sub:
Sub ASub()
Dim aForm As UserForm
Load UserForm1
Load UserForm2
Load UserForm3
MsgBox UserForms(1).Name
For Each aForm In UserForms
If aForm.Name = "UserForm2" Then Exit For
Next
Call AnotherSub(aForm)
End Sub
When I step through the code, it displays 'UserForm2' in the MsgBox.
Stepping further, the part 'If aForm.Name = "UserForm2" Then' results in
run-time error 438: "Object doesn't support this property or method".
Now why is that? And how can I refer to UserForm2 to pass this particular
form as an argument to a sub? UserForms("UserForm2") is not allowed, and
performing a test beforehand on the name of the UserForm apparently is not
allowed either.
Thank you,
Cooz