eine frage.Ich erstelle mit fogendem code eine Menüleiste in meiner Tabelle.
Es tauichen z.b die Zahlen 1 bis 9 auf in dieser symbolleiste.
Ich möchte jetzt erreichen wenn ich eine zahl wähle das diese dann in einer msgbox angezeigt wird.Bekomme ich aber nicht hin ?
meinen versuch habe ich hier mit angehängt.
Für euch sicher kein problem... vielen Dank im vorraus gruß Chris
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim oBar As CommandBar
Dim oBtn As CommandBarButton
Dim rng As Range, rngAll As Range
Dim col As New Collection
Dim arr() As Integer
Dim iNo As Integer, iCol As Integer, iAct As Integer, iPosition As Integer
Dim bln As Boolean
'Bereich für die Symbolleiste eingrenzen
' Set rngAll = Range("B6:J14")
' If Intersect(rngAll, Target) Is Nothing Then Exit Sub
Cancel = True
On Error Resume Next
Application.CommandBars("NumberView").Delete
On Error GoTo 0
Set oBar = Application.CommandBars.Add("NumberView", msoBarPopup, False, True)
For iNo = 1 To 9
Set oBtn = oBar.Controls.Add
With oBtn
.Style = msoButtonCaption
.Caption = iNo
.OnAction = "test"
End With
Next iNo
oBar.ShowPopup
End Sub
'Hier das sub::
Sub test()
'Sollte die gewählte Zahl in einer msgbox Bringen ?
MsgBox ActiveControl
End Sub