Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Cesar Gonzalez   on Feb 04 In MS Office Category.

  
Question Answered By: Renee Lane   on Feb 04

Coming to this late but .....

This sort of construct may help....

Dim ctlCurrent As Control

For Each ctlCurrent In frmpForm.Controls

If TypeOf ctlCurrent Is MSForms.TextBox Then

ElseIf TypeOf ctlCurrent Is MSForms.CommandButton Then

ElseIf TypeOf ctlCurrent Is MSForms.Frame Then

ElseIf TypeOf ctlCurrent Is MSForms.Label Then

ElseIf TypeOf ctlCurrent Is MSForms.UserForm Then

ElseIf TypeOf ctlCurrent Is MSForms.CheckBox Then

ElseIf TypeOf ctlCurrent Is MSForms.ComboBox Then

ElseIf TypeOf ctlCurrent Is MSForms.ListBox Then

ElseIf TypeOf ctlCurrent Is MSForms.OptionButton Then

Else

End If

Next ctlCurrent

It's from a word vba  module but I see no reason it shouldn't work in Excel.

Share: