Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control find John P[_2_] New Users to Excel 1 April 18th 09 05:28 PM
Control on a form to find a record Terry Excel Discussion (Misc queries) 2 September 7th 08 03:04 PM
control find [email protected] Excel Discussion (Misc queries) 1 January 25th 08 03:14 PM
Find lost check box control in workbook TheMath Excel Discussion (Misc queries) 4 April 10th 07 04:24 PM
Lost control - how to find? HFB Excel Programming 1 January 20th 05 04:09 AM


All times are GMT +1. The time now is 01:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"