View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1749_] Rick Rothstein \(MVP - VB\)[_1749_] is offline
external usenet poster
 
Posts: 1
Default Initializing Form Controls

You would use an If-ElseIf-ElseIf-(etc)-End If block. When you type this...

If TypePf ctrl Is msforms.

or this...

ElseIf TypeOf ctrl Is msforms.

as soon as you type the dot after MsForms, you will be offered a list to
select from.

Rick


"PosseJohn" wrote in message
...
How do I distinguish between a ComboBox, ListBox, TextBox, or CheckBox?

"Dave Peterson" wrote:

Dim ctrl as control
for each ctrl in me.controls
if typeof ctrl is msforms.checkbox then
ctrl.value = false
end if
next ctrl

PosseJohn wrote:

I have a form that has many checkboxes. I would like to initialize all
of
them to false.

What code would cycle thru the controls and determine if it is a
checkbox?

For Each chk in Me.Controls
If ????
Me.Controls(chk) = False
End If
Next


--

Dave Peterson