Determine type of control??

C

ck

I have a form I made in the VBE for an outlook application. Not an Outlook
form a regular VBA form. Anyways. Can I loop through the controls and find
out the state of 5 check boxes? I thought there was a typeof function or
something. My desired result would be something like:

dim ctl as control

for each ctl in me.controls
~>if control is checkbox then
do something
end if
next

bla blah blah.

Can you determine the type of control through code????
Thanks everyone,
~ck
 
C

Chip Pearson

CK,

Use code like the following:

Dim Ctrl As MSForms.Control
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is MSForms.CheckBox Then
MsgBox Ctrl.Caption
End If
Next Ctrl


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
C

ck

Perfect, that worked great. Thanks!!!

Chip Pearson said:
CK,

Use code like the following:

Dim Ctrl As MSForms.Control
For Each Ctrl In Me.Controls
If TypeOf Ctrl Is MSForms.CheckBox Then
MsgBox Ctrl.Caption
End If
Next Ctrl


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top