Eigenes Zell-Kontextmenü

25.09.2001

 

Ein neues Zell-Kontextmenü erstellen.
Das vorhandene (Standard) Kontextmenü wird dabei gelöscht.


Sub NeuesKontextMenü()
    Dim M As CommandBarButton
    With CommandBars("Cell")
        Do While .Controls.Count > 0
            On Error Resume Next
            .Controls(1).Delete
        Loop
        Set M = .Controls.Add(msoControlButton)
        With M
            .Caption = "&Mein Kontextmenü..."
            .OnAction = "MachWas"
            .FaceId = 200
        End With
        Set M = .Controls.Add(msoControlButton)
        With M
            .Caption = "&Kontextmenü zurücksetzen"
            .OnAction = "Reset"
            .FaceId = 44
        End With
    End With
End Sub
Sub MachWas()
    MsgBox "Hallo !", vbExclamation
End Sub
Sub Reset()
    CommandBars("Cell").Reset
End Sub