Live-Forum - Die aktuellen Beiträge
Datum
Titel
24.04.2024 19:29:30
24.04.2024 18:49:56
24.04.2024 17:19:09
Anzeige
Archiv - Navigation
864to868
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
864to868
864to868
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

eigene menüleiste und standardmenüpunkte

eigene menüleiste und standardmenüpunkte
02.05.2007 12:40:21
Andreas
hallo an alle,
ich habe eine eigene menüleiste wobei die standardmenüleiste ausgeblendet ist, möchte aber aus dem standartmenüpunkt "DATEI" die untermenüs: seitenansicht, speichern, speichern unter, drucken, beenden in meinen menüpunkt, der auch datei heißt, einfügen.
genau das ist mein problem: ich bekomme es nicht hin.
kann mir jemand von euch dabei helfen?
hier ein auszug aus dem makro:
Sub Menü1_Erstellen()
Application.ScreenUpdating = False
Dim NeueMenüleiste As Object, AktiveMenüleiste As Object, Schaltfläche As Object, Neu As Object
On Error Resume Next
'Menüleiste löschen falls schon vorhanden
Application.CommandBars("NeueMenüleiste").Delete
'Menüleiste hinzufügen und einblenden
Set Neu = CommandBars.Add(Name:="NeueMenüleiste", MenuBar:=True)
CommandBars("NeueMenüleiste").Visible = True
Set AktiveMenüleiste = CommandBars.ActiveMenuBar
'Menü erstellen
Set NeueMenüleiste = AktiveMenüleiste.Controls.Add(Type:=msoControlPopup, Temporary:=True)
NeueMenüleiste.Caption = "&Datei"
'Erste Schaltfläche
Set Schaltfläche = NeueMenüleiste.Controls.Add
With Schaltfläche
.FaceId = 2 'Icon, das auf der Schaltfläche angezeigt wird
.Caption = "&Speichern" 'Angezeigter Text auf 1. Schaltfläche im PopUp Menü
.OnAction = "Beispieltaste1" 'Makro das ausgeführt wird beim Betätigen der Schaltfläche
.TooltipText = "Öffnet MsgBox1" 'Text der beim Berühren der Schaltfläche angezeigt wird
.Style = msoButtonIconAndCaption 'Schaltflächentyp
End With
vielen dank im voraus
gruß
andreas

4
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: eigene menüleiste und standardmenüpunkte
02.05.2007 13:39:42
Rudi
Hallo,
füge die Schaltflächen anhand ihrer IDs ein.
Wenn du die Standardfunktionen und Beschriftung erhalten willst, lass .onAction, .Caption und .FaceID weg.

Sub Menü1_Erstellen()
Application.ScreenUpdating = False
Dim NeueMenüleiste As Object, AktiveMenüleiste As Object, Schaltfläche As Object, Neu As Object
On Error Resume Next
'Menüleiste löschen falls schon vorhanden
Application.CommandBars("NeueMenüleiste").Delete
'Menüleiste hinzufügen und einblenden
Set Neu = CommandBars.Add(Name:="NeueMenüleiste", MenuBar:=True)
CommandBars("NeueMenüleiste").Visible = True
Set AktiveMenüleiste = CommandBars.ActiveMenuBar
'Menü erstellen
Set NeueMenüleiste = AktiveMenüleiste.Controls.Add(Type:=msoControlPopup, Temporary:=True)
NeueMenüleiste.Caption = "&Datei"
Set Schaltfläche = NeueMenüleiste.Controls.Add(ID:=109)
Set Schaltfläche = NeueMenüleiste.Controls.Add(ID:=3)
Set Schaltfläche = NeueMenüleiste.Controls.Add(ID:=748)
Set Schaltfläche = NeueMenüleiste.Controls.Add(ID:=4)
Set Schaltfläche = NeueMenüleiste.Controls.Add(ID:=752)
End Sub


IDs:
Seitenansicht: 109
Speichern: 3
Speichern unter: 748
Drucken: 4
Beenden: 752
Gruß
Rudi
Eine Kuh macht Muh, viele Kühe machen Mühe

Anzeige
AW: eigene menüleiste und standardmenüpunkte
03.05.2007 17:15:00
Andreas
hallo rudi,
danke für die schnelle und hilfreiche antwort.
es funzt so wie ich es wollte.
ein frage hab ich doch noch:
wo oder wie komme ich an diese id`s?
gibt es eine liste darüber und über die face id?
gruß
andreas

AW: eigene menüleiste und standardmenüpunkte
04.05.2007 09:12:58
Rudi
Hallo,
zum Anzeigen der Face-Ids: https://www.herber.de/tools/symbolpicker.zip
Die Ids der Commandbarbuttons (nicht schön aber wirkungsvoll):

Public Sub Zeig_Alles()
' Listet alle CommandbarControls in einer eigenen Commandbar auf
'Code: ransi
Dim reset As CommandBarControl
Dim cb As CommandBar
Dim c As CommandBar
Dim a As CommandBar 'Zähler
Dim b As CommandBarControl
Dim cneu As CommandBarControl 'neu
Dim d As CommandBarControl 'Zähler
Dim e As CommandBarControl 'neu
Dim f As CommandBarControl 'Zähler
Dim g As CommandBarControl 'neu
Dim h As CommandBarControl 'zähler
Dim i As CommandBarControl 'neu
Dim j As CommandBarControl
Dim k As CommandBarControl
Dim vb As CommandBarControl
On Error Resume Next
DoEvents
Application.ScreenUpdating = False
For Each cb In Application.CommandBars
If cb.Name = "Alle Infos" Then cb.Delete
Next
Set c = Application.CommandBars.Add(Name:="Alle Infos")
Set b = c.Controls.Add(10)
Set vb = c.Controls.Add(10)
Set reset = c.Controls.Add(1)
b.Caption = "ID's "
vb.Caption = "VBE's"
With reset 'für Neuberechnung
.Caption = "Reset"
.Style = msoButtonIconAndCaption
.FaceId = 940
.OnAction = "Zeig_alles"
End With
c.Visible = True
For Each a In Application.CommandBars
If a.Name  "Alle Infos" Then
Set cneu = b.Controls.Add(Type:=msoControlPopup)
cneu.Caption = a.NameLocal ' & " ID:=" & a.ID & ", Type:= " & a.Type'ab XP funzt das  _
auch
If a.Controls.Count > 0 Then
For Each d In a.Controls
If Not d Is Nothing Then
Set e = cneu.Controls.Add(Type:=IIf(d.Type = 1, 1, 10))
With e 'Eigenschaften des Originals abschreiben
.Caption = d.Caption & " ID:=" & d.ID & ", Type:= " & d.Type
.Style = d.Style
.FaceId = d.FaceId
.BeginGroup = d.BeginGroup
End With
End If
If d.Controls.Count > 0 Then
For Each f In d.Controls
If Not f Is Nothing Then
Set g = e.Controls.Add(Type:=IIf(f.Type = 1, 1, 10))
With g 'Eigenschaften des Originals abschreiben
.Caption = f.Caption & " ID:=" & f.ID & ", Type:= " & f.Type
.Style = f.Style
.FaceId = f.FaceId
.BeginGroup = f.BeginGroup
End With
End If
If f.Controls.Count > 0 Then
For Each h In f.Controls
If Not h Is Nothing Then
Set i = g.Controls.Add(Type:=IIf(h.Type = 1, 1, 10))
With i 'Eigenschaften des Originals abschreiben
.Caption = h.Caption & " ID:=" & h.ID & ", Type:= " & h.Type
.Style = h.Style
.FaceId = h.FaceId
.BeginGroup = h.BeginGroup
End With
End If
For Each j In h.Controls
If Not j Is Nothing Then
Set k = i.Controls.Add(Type:=IIf(j.Type = 1, 1, 10))
With k
.Caption = j.Caption & " ID:=" & j.ID & ", Type:= " & j.Type
.Style = j.Style
.FaceId = j.FaceId
.BeginGroup = j.BeginGroup
End With
End If
Next
Next
End If
Next
End If
Next
End If
End If
Next
Set a = Nothing
Set reset = Nothing
Set cb = Nothing
Set c = Nothing
Set d = Nothing
Set cneu = Nothing
Set e = Nothing
Set f = Nothing
Set g = Nothing
Set h = Nothing
Set i = Nothing
Set j = Nothing
Set k = Nothing
For Each a In Application.VBE.CommandBars
If a.Name  "Alle Infos" Then
Set cneu = vb.Controls.Add(Type:=msoControlPopup)
cneu.Caption = a.NameLocal '& " ID:=" & a.ID & ", Type:= " & a.Type
If a.Controls.Count > 0 Then
For Each d In a.Controls
If Not d Is Nothing Then
Set e = cneu.Controls.Add(Type:=IIf(d.Type = 1, 1, 10))
With e 'Eigenschaften des Originals abschreiben
.Caption = d.Caption & " ID:=" & d.ID & ", Type:= " & d.Type
.Style = d.Style
.FaceId = d.FaceId
.BeginGroup = d.BeginGroup
End With
End If
If d.Controls.Count > 0 Then
For Each f In d.Controls
If Not f Is Nothing Then
Set g = e.Controls.Add(Type:=IIf(f.Type = 1, 1, 10))
With g 'Eigenschaften des Originals abschreiben
.Caption = f.Caption & " ID:=" & f.ID & ", Type:= " & f.Type
.Style = f.Style
.FaceId = f.FaceId
.BeginGroup = f.BeginGroup
End With
End If
If f.Controls.Count > 0 Then
For Each h In f.Controls
If Not h Is Nothing Then
Set i = g.Controls.Add(Type:=IIf(h.Type = 1, 1, 10))
With i 'Eigenschaften des Originals abschreiben
.Caption = h.Caption & " ID:=" & h.ID & ", Type:= " & h.Type
.Style = h.Style
.FaceId = h.FaceId
.BeginGroup = h.BeginGroup
End With
End If
For Each j In h.Controls
If Not j Is Nothing Then
Set k = i.Controls.Add(Type:=IIf(j.Type = 1, 1, 10))
With k
.Caption = j.Caption & " ID:=" & j.ID & ", Type:= " & j.Type
.Style = j.Style
.FaceId = j.FaceId
.BeginGroup = j.BeginGroup
End With
End If
Next
Next
End If
Next
End If
Next
End If
End If
Next
Application.ScreenUpdating = True
Set a = Nothing
Set reset = Nothing
Set cb = Nothing
Set c = Nothing
Set d = Nothing
Set cneu = Nothing
Set e = Nothing
Set f = Nothing
Set g = Nothing
Set h = Nothing
Set i = Nothing
Set j = Nothing
Set k = Nothing
Set vb = Nothing
End Sub


Gruß
Rudi
Eine Kuh macht Muh, viele Kühe machen Mühe

Anzeige
AW: eigene menüleiste und standardmenüpunkte
04.05.2007 18:06:43
Andreas
vielen, vielen dank,
ist schon irre was man mit excel und vba so alles machen kann.
nochmal danke und ein schönes wochenende.
gruß
andreas

300 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige