Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
364to368
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
364to368
364to368
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Untermenü Popup

Untermenü Popup
16.01.2004 11:55:39
Sven
Hallo Cracks, habe folgendes Problem,
Ich Habe ein eigenes Menü erstellt, möchte aber, daß sich bei Anklicken des Buttons "Farbe" ein Untermenü öffnet, wo ich die jeweilige Farbe wählen kann (sprich, die Makris), hier mein jetzoger code:
Private Sub workbook_open()
Dim cb As CommandBar
Dim CBC As CommandBarButton
Dim i%

On Error Resume Next
Set cb = Application.CommandBars.Add(Name:="Urlaub", _
temporary:=True, Position:=msoBarTop)
With cb
.Left = 50
End With
On Error GoTo 0
If Application.CommandBars("Urlaub").Visible = False Then
cb.Visible = True
For i = 1 To 1
Set CBC = cb.Controls.Add(Type:=msoControlButton)
With CBC
Select Case i

Case 1
.Style = msoButtonIcon
.FaceId = 417
.OnAction = "farbe"
.TooltipText = "einfärben"
.Width = "25"

End Select
End With
Next i
End If

Ich danke Euch !!!
Sven

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Untermenü Popup
16.01.2004 12:18:09
xXx
Hallo,
was soll das: For i=1 to 1?
Hier mal ein Beispielcode, kannst du dir umbauen:

Sub Menü_einfügen()
Dim NeuesMenue As CommandBar, St As CommandBarButton, Pop1 As CommandBarPopup
On Error Resume Next
Application.CommandBars("MeineLeiste").Delete
On Error GoTo 0
Set NeuesMenue = CommandBars.Add(Name:="MeineLeiste", temporary:=True)
With NeuesMenue
.Position = msoBarTop
.Visible = True
End With
Set Pop1 = NeuesMenue.Controls.Add(Type:=msoControlPopup)
Pop1.Caption = "MeineMakros"
Set St = Pop1.Controls.Add(Type:=msoControlButton, ID:=1)
With St
.Caption = "Makro 1"
.Style = msoButtonCaption
.OnAction = "Makro_1"
End With
Set St = Pop1.Controls.Add(Type:=msoControlButton, ID:=1)
With St
.Caption = "Makro 2"
.Style = msoButtonCaption
.OnAction = "Makro_2"
End With
Set St = Pop1.Controls.Add(Type:=msoControlButton, ID:=1)
With St
.Caption = "Makro 3"
.Style = msoButtonCaption
.OnAction = "Makro_3"
End With
'und so weiter und so fort
End Sub

Gruß aus'm Pott
Udo
http://www.excelerator.de

P.S. Das Forum lebt auch von den Rückmeldungen an die Antworter!
Anzeige
AW: Untermenü Popup
16.01.2004 12:25:45
P@ulchen
Hallo Sven,
meinst Du so :


Private Sub workbook_open()
Dim cb As CommandBar
Dim CBC As CommandBarButton
Dim CBCPopup As CommandBarPopup
Dim i%
On Error Resume Next
Set cb = Application.CommandBars.Add(Name:="Urlaub", _
temporary:=True, Position:=msoBarTop)
With cb
    .Left = 50
End With
On Error GoTo 0
If Application.CommandBars("Urlaub").Visible = False Then
    cb.Visible = True
    Set CBCPopup = cb.Controls.Add(Type:=msoControlPopup)
    CBCPopup.Caption = "Farbe"
    Set CBC = Application.CommandBars("Urlaub").Controls("Farbe").Controls.Add(Type:=msoControlButton)
    With CBC
        .Caption = "Rot"
        .OnAction = "Rot"
        .TooltipText = "einfärben"
        .BeginGroup = False
        .Style = msoButtonCaption
    End With
    Set CBC = Application.CommandBars("Urlaub").Controls("Farbe").Controls.Add(Type:=msoControlButton)
    With CBC
        .Caption = "Blau"
        .OnAction = "Blau"
        .TooltipText = "einfärben"
        .BeginGroup = False
        .Style = msoButtonCaption
    End With
  
End If
End Sub

     Code eingefügt mit Syntaxhighlighter 2.1

Gruß
P@ulchen
Das Forum lebt auch von den Rückmeldungen !
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige