Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cant find Control
Below is a code that programmatically adds an optionbutton to a
userform. This code works fine but when I try to retrieve all the names of every control, the optionbutton shows up as 0. Its like it does not have a name. Dim OB_PriceKPI As MSForms.OptionButton ' Adds New Labels Set OB_PriceKPI = KPIWizard.Controls.Add("forms.optionbutton.1", Visible) With OB_PriceKPI .Name = "OB_PriceKPI" .Width = 100 .Height = 18.75 .Left = 36 .Top = 60 '.AutoSize = True .Font.Size = 8 .Font.Bold = True .Caption = "Price" End With The optionbutton should be called "OB_PriceKPI" as I have specified in the above code. Below is the code I use to bring back all the names of every control on my userform: For Each ctl In Me.Controls MsgBox ctl.Name Next Last, here is what I am trying to test for with the optionbutton, but everytime it gets to the If statement, I get an error saying object required. Again, its like the button does not exist but I just created it with the 1st code. Select Case Level Case 1 If OB_PriceKPI.Value = True Then KPITargetType = "PP" Else KPITargetType = "Feature" End If Case Else End Select Can anyone help me? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Control find | New Users to Excel | |||
Control on a form to find a record | Excel Discussion (Misc queries) | |||
control find | Excel Discussion (Misc queries) | |||
Find lost check box control in workbook | Excel Discussion (Misc queries) | |||
Lost control - how to find? | Excel Programming |