View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Oak Oak is offline
external usenet poster
 
Posts: 5
Default Combo Box Events - Self-Referencing

Thank you, but my reference to 'itm' instead of 'item' was my typo in forum question only,
the corrected message below here is more accurate. Therefore, the error remains the same "Compile Error: Method or data member not found with the highlighted focus on the '.CcboItem =

Any ideas what the problem is
Thank you much

After creating the ComboBox Item Class as follows, Clas
Module Property Name = CcboIte
Public WithEvents cboItem As MSForms.ComboBo
Private Sub cboItem_Change(

With cboIte
If .Value < "" Or .Value = Null The
DoThisCode(
End I
End Wit
And in the Workbook module

Option Explici
Dim colCBOs As Collectio
Private Sub Workbook_Open(

'Declare variables for use in CBO Collection initialization procedur
Dim objOle As Object, cboTemp As CcboIte
'Initialize ComboBox Collection - Will use Class CcboIte

For Each objOle In Worksheets(1).OLEObject
If TypeOf objOle.Object Is MSForms.ComboBox The
Set cboTemp = New CcboIte
' ERROR on line below: CcboItem Highlighted, 'Method or data member not found
Set cboTemp.CcboItem = objOle.Objec
colCBOs.Add cboTemp 'Don't see why this line is here, as the Collection added to, does not seem used
End I
Next objOl
End Su
----- Oak wrote: ----

Would anyone know how to code a ComboBox self-reference

so that it could be used in a Combo Box processing procedure tha
was called from multiple ComboBox Change events, in each cas
referring to the specific ComboBox from which it was bein
called
For instance, in the below procedure I want to be able t

use it in multiple ComboBox Change events and in each ComboBox
it will being making reference to its own value (ComboBox.Value)
but not sure how to code to have each ComboBox make
self-reference that can be used in its code, but that is cod
that can be used in a procedure to be called from within multipl
ComboBoxes?
Public Sub CBOItemProcess(

with (WhatGoesHere?_that_could_reference_whatever_Combo Box_the_procedure_was_being_called_from.
If .Value = "RT239" The
Call ThisProcedur
ElseIf .Value = "JY457" The
Call ThisOtherProcedur
ElseIf .Value = "WN2345" The
Call AnotherProcedur
End I
End Wit
End Su
Thank you for any assistanc