ich habe folgendes Problem:
Es exisiter ein AddIn in dem Ich eine Klasse ("MyComboBox") erstellt habe die wie folgt ausssieht:
Private m_cmbSheetComboBox As Shape
Private Sub Class_Initialize()
Dim width, height, left, top As Long
left = ActiveCell.left
top = ActiveCell.top
height = ActiveCell.height
width = ActiveCell.width
Set m_cmbSheetComboBox = Worksheets(1).Shapes.AddFormControl(xlDropDown,_
left, top, width, height)
m_cmbSheetComboBox.OnAction = "ComboBoxClick"
End Sub
'Funktion wertet Combobox aus
Public Function ComboBoxClick() As String
If Not m_cmbSheetComboBox Is Nothing Then
ActiveCell.value = m_cmbSheetComboBox.ControlFormat.list(_
m_cmbSheetComboBox.ControlFormat.ListIndex)
m_cmbSheetComboBox.Delete
End If
End Function
'Funktion fügt ein Element hinzu
Public Sub AddItem(str As String)
If Not m_cmbSheetComboBox Is Nothing Then
m_cmbSheetComboBox.ControlFormat.AddItem str
End If
End Sub
Public Sub Delete()
If Not m_cmbSheetComboBox Is Nothing Then
m_cmbSheetComboBox.Delete
End If
End Sub
Public Sub text(text As String)
m_cmbSheetComboBox.ControlFormat.value = text
End Sub
Des Weiteren erzeuge ich mir in der Application Event Funktion
(App_SheetSelectionChange) von dieser Klasse ein Objekt (vorher als Public cmb As MyComboBox deklariert).
Der weitere Ablauf in "App_SheetSelectionChange" sieht dann so aus:
Set cmb = New MyComboBox
cmb.AddItem ("1")
cmb.AddItem ("2")
cmb.AddItem ("3")
cmb.text "3"
Die Darstellung auf dem Sheet funktioniert ohne Probleme, es sind auch alle
Werte vorhanden. Was ich nun möchte ist einen dieser Werte auswählen und ihn
dann in die aktive Zelle durch die Funktion "ComboBoxClick" schreiben.
Nur Excel meint das in meinem Addin eben diese Funktion die ich vorher in OnAction angegeben habe nicht vorhanden ;o(. Gibt es einen Weg wie ich trotzdem
diesesn Ablauf rel. dynamisch gestalten kann?
Ich bedanke mich schon im vorraus falls mir jemand helfen kann.
Gruß
Nico