Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Lydia Hughes   on Oct 03 In MS Office Category.

  
Question Answered By: Adalard Fischer   on Oct 03

I came up with a solution and it works!
Here is the VBA code  for anybody interested.
=======================================

Dim ctl As Control
Dim myOpt As MSForms.OptionButton
Dim myForm As MSForms.UserForm
Dim myTxt As MSForms.TextBox
Set myForm = UserForm10
For Each ctl In myForm.Controls
If InStr(1, ctl.Name, "Frame", vbTextCompare) Then
'MsgBox ("FrameName: " & ctl.Name)
'leave frame  asis
ElseIf InStr(1, ctl.Name, "TextBox", vbTextCompare) Then
'MsgBox ("TextBoxName: " & ctl.Name)
Set myTxt = ctl
myTxt.Text = ""
ElseIf InStr(1, ctl.Name, "Label", vbTextCompare) Then
'MsgBox ("LabelName: " & ctl.Name)
'leave label asis
ElseIf InStr(1, ctl.Name, "OptionButton", vbTextCompare) Then
'MsgBox ("OptionName: " & ctl.Name)
Set myOpt = ctl
myOpt.Value = False
End If
Next ctl

Share: 

 

This Question has 7 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on All Frames and Optionbuttons in a UserForm Or get search suggestion and latest updates.


Tagged: