Thymen
02-16-2006, 12:24 PM
Hi Folks,
been searching for quite some time, but cannot find an answer to my question, so if you know, plse help....
I want to figure out the type of control on a form. I tried the following:
Dim myControl As Control
On Error Resume Next
For Each myControl In UserForm1.Controls
If (myControl.Type = xlButton) Then MsgBox "Button" Else MsgBox "Not a button"
Next myControl
I want to use this kind of code to dump the contents of all controls that are e.g. textboxes (xlTextBox) to cells on a worksheet, while leaving all other control types be. But.... myControl.Type does not work.... Am I overlooking something?
Help greatly appreciated!
Thymen
been searching for quite some time, but cannot find an answer to my question, so if you know, plse help....
I want to figure out the type of control on a form. I tried the following:
Dim myControl As Control
On Error Resume Next
For Each myControl In UserForm1.Controls
If (myControl.Type = xlButton) Then MsgBox "Button" Else MsgBox "Not a button"
Next myControl
I want to use this kind of code to dump the contents of all controls that are e.g. textboxes (xlTextBox) to cells on a worksheet, while leaving all other control types be. But.... myControl.Type does not work.... Am I overlooking something?
Help greatly appreciated!
Thymen