View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
steve bell steve bell is offline
external usenet poster
 
Posts: 8
Default Generic ComboBox change event

Tom,

You're being great...

made these 2 macros and get a Run time error '13', Type
Mismatch at the start of the For loop

Once this code is working, how do I get it to return the
name of the combobox??? And what triggers the macro?

(Working with controls is not my best...)

Your help is much appreciated...

Standard -
Option Explicit
Dim CBox() As New Class1

Sub ShowDialog()
Dim CBcount As Integer
Dim oleObj As OLEObjects

' Create the ComboBox objects
CBcount = 0
For Each oleObj In ActiveSheet.OLEObjects

If TypeOf oleObj.Object Is MSForms.ComboBox Then
CBcount = CBcount + 1
ReDim Preserve CBox(1 To CBcount)
Set CBox(CBcount).CmboBoxGroup = oleObj
End If
Next oleObj

End Sub

Class -
Option Explicit

Public WithEvents CmboBoxGroup As ComboBox

Private Sub CmboBoxGroup_Change()
MsgBox "Hello from " & CmboBoxGroup.Name
End Sub

steve

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!