Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Adding CheckBox Caption to a Listbox

Could anybody please give me some ideas for this problem.
Ref:All the controls I have used are ActiveX and emmbedded into a
worksheet.

I am trying to loop through a grouped set of checkboxes and if the
value is true then I want to load the Caption of the checkbox into a
listbox, or a TextBox. I can get everything to work except loading the
caption of the checkBox into the listBox. I can get the Caption to load
into a Listbox if I use the click event of a checkbox itself but I
can't seem to get it to work within the loop.
Note: The counter is for testing only.
Private Sub CommandButton1_Click()
Dim OLEObj As OLEObject
i = 0
For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
If OLEObj.Object.GroupName = "ImmediateCauseAct" Then
If OLEObj.Object.Value = True Then
ListBox1.AddItem OLEObj.Oject.Caption ??Problem Line
i = i + 1
End If
End If
End If
Next OLEObj
MsgBox i
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Adding CheckBox Caption to a Listbox

Private Sub CommandButton1_Click()
Dim OLEObj As Object
Dim i As Long
i = 0
For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
If OLEObj.Object.GroupName = "ImmediateCauseAct" Then
If OLEObj.Object.Value = True Then
ListBox1.AddItem OLEObj.Object.Caption
i = i + 1
End If
End If
End If
Next OLEObj
MsgBox i
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Peterd" wrote in message
oups.com...
Could anybody please give me some ideas for this problem.
Ref:All the controls I have used are ActiveX and emmbedded into a
worksheet.

I am trying to loop through a grouped set of checkboxes and if the
value is true then I want to load the Caption of the checkbox into a
listbox, or a TextBox. I can get everything to work except loading the
caption of the checkBox into the listBox. I can get the Caption to load
into a Listbox if I use the click event of a checkbox itself but I
can't seem to get it to work within the loop.
Note: The counter is for testing only.
Private Sub CommandButton1_Click()
Dim OLEObj As OLEObject
i = 0
For Each OLEObj In ActiveSheet.OLEObjects
If TypeOf OLEObj.Object Is MSForms.CheckBox Then
If OLEObj.Object.GroupName = "ImmediateCauseAct" Then
If OLEObj.Object.Value = True Then
ListBox1.AddItem OLEObj.Oject.Caption ??Problem Line
i = i + 1
End If
End If
End If
Next OLEObj
MsgBox i
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Adding CheckBox Caption to a Listbox

So easy, I have spent about a week reading through posts trying to
solve this, thanks very much bob

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
adding a checkbox Pat Excel Discussion (Misc queries) 2 January 26th 07 03:05 PM
VBA: Creating listbox similar to the one in Pivot table (Listbox+Checkbox) modjoe23 Excel Programming 3 August 18th 05 02:35 PM
Excel VBA - Capturing a checkbox caption into a worksheet. rott[_9_] Excel Programming 1 June 19th 04 07:43 PM
listbox with checkbox or radiobutton groups Mark[_36_] Excel Programming 2 February 12th 04 02:44 PM
Listbox w/CheckBox Options Bob Salvato Excel Programming 1 September 2nd 03 04:44 PM


All times are GMT +1. The time now is 11:30 AM.

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"