kashif.special2005
Active Member
- Joined
- Oct 26, 2009
- Messages
- 443
Hi,
I want to create a procedure where I will pass a userform object and that procedure will give me the all controls name and type related to that form, I have created below procedure but it is not working.
When I run procedure "Test2", in the line "Set myForm = FundInfoForm" it is firing the Initialize event of the form, which is I don't want, and in the procedure "PrintAllControlsInAForm" is printing only blank lines.
Please help me resolve this problem or please guide me how can i achieve this task.
Thanks
Kashif
I want to create a procedure where I will pass a userform object and that procedure will give me the all controls name and type related to that form, I have created below procedure but it is not working.
When I run procedure "Test2", in the line "Set myForm = FundInfoForm" it is firing the Initialize event of the form, which is I don't want, and in the procedure "PrintAllControlsInAForm" is printing only blank lines.
Please help me resolve this problem or please guide me how can i achieve this task.
Code:
Sub Test2()
Dim myForm As msforms.UserForm
Set myForm = FundInfoForm [I][B]'Here it is firing the Initialize Event of this form[/B][/I]
Call PrintAllControlsInAForm(myForm)
End Sub
Sub PrintAllControlsInAForm(msfTargetForm As msforms.UserForm)
Dim msControl As msforms.Control
For Each msControl In msfTargetForm.Controls
Debug.Print mscontrols [I][B]'Here it is printing only blank lines in the Immediate window[/B][/I]
Next msControl
End Sub
Thanks
Kashif