Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
440to444
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
440to444
440to444
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Hilfe - Fehler bei Menüerstellung u. Ausblendung -

Hilfe - Fehler bei Menüerstellung u. Ausblendung -
15.06.2004 14:14:18
Andy
Hallo,
ich habe mühselig mir einiges mit Hilfe dieses Forums erstellt
und es funktioniert auch vieles. Nun habe ich aber ein Problem
mit der Menüleiste. Mein Befehl dafür:

Sub Menue_ein()
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
Application.WindowState = xlMaximized
Application.ShortcutMenus(xlDesktop).Enabled = False
Application.ShortcutMenus(xlTitleBar).Enabled = False
Application.ScreenUpdating = False
Application.CommandBars("Worksheet Menu Bar").Controls(7).Delete
Application.CommandBars("Worksheet Menu Bar").Controls(7).Delete
Application.CommandBars("Worksheet Menu Bar").Controls(7).Delete
Application.CommandBars("Worksheet Menu Bar").Controls(7).Delete
Application.CommandBars("Worksheet Menu Bar").Controls(7).Delete
Application.CommandBars("Worksheet Menu Bar").Controls(7).Delete
Application.CommandBars("Worksheet Menu Bar").Controls(7).Delete
Application.CommandBars("Worksheet Menu Bar").Controls(8).Delete
Application.CommandBars("Worksheet Menu Bar").Controls(8).Delete
Application.CommandBars("Worksheet Menu Bar").Controls(8).Delete
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Visual Basic").Visible = False
Application.DisplayFullScreen = True
Set ML = Application.CommandBars("Worksheet Menu Bar")
' Name für neues Menü anlegen
Set U1 = ML.Controls.Add(Type:=msoControlPopup, Before:=1) 'Before:=10)
U1.Caption = "Bearbeiten"
U1.Tag = "MeinMenü" ' dient zur eindeutigen Identifizierung des Menüs
'    1. Menüpunkt anlegen
'    Set Punkt = U1.Controls.Add(Type:=msoControlPopup)
Set Punkt = U1.Controls.Add(Type:=msoControlPopup)
With Punkt
.Caption = "Dienst auswählen"
End With
Set U2 = Punkt ' Variable für das 2. Untermenü wird gesetzt
' Neuer Menüeintrag im 2.Untermenü
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Außendienst"
.OnAction = "AD"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Innendienst"
.OnAction = "ID"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Dienstbesprechung"
.OnAction = "DB"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Dienstreise (geplant)"
.OnAction = "gD"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Dienstreise (genehmigt)"
.OnAction = "D"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Erholungsurlaub (geplant)"
.OnAction = "gEU"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Erholungsurlaub (genehmigt)"
.OnAction = "EU"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Fortbildung (geplant)"
.OnAction = "gFortbildung"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Fortbildung (genehmigt)"
.OnAction = "Fortbildung"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Krank"
.OnAction = "Krank"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Sonderurlaub (geplant)"
.OnAction = "gSU"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Sonderurlaub (genehmigt)"
.OnAction = "SU"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "sonstige Gründe"
.OnAction = "S"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Überstundenabwicklung (geplant)"
.OnAction = "gÜS"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Überstundenabwicklung (genehmigt)"
.OnAction = "ÜS"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Zeitausgleich (geplant)"
.OnAction = "gZeitausgleich"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Zeitausgleich (genehmigt)"
.OnAction = "Zeitausgleich"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Za/Ü (geplant)"
.OnAction = "gZa/Ü"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Za/Ü (genehmigt)"
.OnAction = "Za/Ü"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "1/2 Za, vormittags (geplant)"
.OnAction = "ghalbZaVM"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "1/2 Za, vormittags (genehmigt)"
.OnAction = "halbZaVM"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "1/2 Za, nachmittags (geplant)"
.OnAction = "ghalbZaNM"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "1/2 Za, nachmittags (genehmigt)"
.OnAction = "halbZaNM"
End With
Set Punkt = U2.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Altersteilzeit"
.OnAction = "ATZ"
End With
' Weiterer Eintrag im 1.Untermenü
Set Punkt = U1.Controls.Add(Type:=msoControlPopup)
With Punkt
.Caption = "Notiz"
'.OnAction = "MsgBox4"
End With
' Untermenü erstellen
Set U3 = Punkt ' Variable für das 2. Untermenü wird gesetzt
' Neuer Menüeintrag im 2.Untermenü
Set Punkt = U3.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Notiz einfügen"
.OnAction = "Notiz"
End With
Set Punkt = U3.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Notiz löschen"
.OnAction = "Notiz_löschen"
End With
' 2. Menü anlegen:
Set U11 = ML.Controls.Add(Type:=msoControlPopup, Before:=2) 'Before:=10)
U11.Caption = "Drucken"
U11.Tag = "MeinMenü" ' dient zur eindeutigen Identifizierung des Menüs
Set Punkt = U11.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Zeitraum"
.OnAction = "Drucken"
End With
Set Punkt = U11.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Legende drucken"
.OnAction = "Legende_drucken"
End With
' 3. Menü anlegen:
Set U12 = ML.Controls.Add(Type:=msoControlPopup, Before:=3) 'Before:=10)
U12.Caption = "Suchen"
U12.Tag = "MeinMenü" ' dient zur eindeutigen Identifizierung des Menüs
Set Punkt = U12.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Suche nach Datum"
.OnAction = "Suche"
End With
' 4. Menü anlegen:
Set U13 = ML.Controls.Add(Type:=msoControlPopup, Before:=4) 'Before:=10)
U13.Caption = "Heute"
U13.Tag = "MeinMenü" ' dient zur eindeutigen Identifizierung des Menüs
Set Punkt = U13.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Gehezu Heute"
.OnAction = "Heute"
End With
' 5. Menü anlegen:
Set U14 = ML.Controls.Add(Type:=msoControlPopup, Before:=5) 'Before:=10)
U14.Caption = "Info"
U14.Tag = "MeinMenü" ' dient zur eindeutigen Identifizierung des Menüs
Set Punkt = U14.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Info"
.OnAction = "Info"
End With
' 6. Menü anlegen:
Set U15 = ML.Controls.Add(Type:=msoControlPopup, Before:=6) 'Before:=10)
U15.Caption = "Beenden"
U15.Tag = "MeinMenü" ' dient zur eindeutigen Identifizierung des Menüs
Set Punkt = U15.Controls.Add(Type:=msoControlButton)
With Punkt
.Caption = "Beenden"
.OnAction = "Programm_beenden"
End With
End Sub

Nun komme ich aber mit dem Ausblenden nicht klar,
er meckert mich immer an, weil auch nicht auf jedem
PC das gleiche Menüangebot ist usw. Beim Wiederherstellen
bekomme ich das gleich gar nicht hin, weil er nicht fragt,
was es schon gibt. Das sieht bei mir ua. so aus:

Sub MenuRückSetzen()
Application.CommandBars("Worksheet Menu Bar").Controls.Add Type:= _
msoControlPopup, ID:=30002, Before:=1
Application.CommandBars("Worksheet Menu Bar").Controls.Add Type:= _
msoControlPopup, ID:=30003, Before:=2
Application.CommandBars("Worksheet Menu Bar").Controls.Add Type:= _
msoControlPopup, ID:=30004, Before:=3
Application.CommandBars("Worksheet Menu Bar").Controls.Add Type:= _
msoControlPopup, ID:=30005, Before:=4
Application.CommandBars("Worksheet Menu Bar").Controls.Add Type:= _
msoControlPopup, ID:=30006, Before:=5
Application.CommandBars("Worksheet Menu Bar").Controls.Add Type:= _
msoControlPopup, ID:=30007, Before:=6
Application.CommandBars("Worksheet Menu Bar").Controls.Add Type:= _
msoControlPopup, ID:=30011, Before:=7
Application.CommandBars("Worksheet Menu Bar").Controls.Add Type:= _
msoControlPopup, ID:=30009, Before:=8
Application.CommandBars("Worksheet Menu Bar").Controls.Add Type:= _
msoControlPopup, ID:=30010, Before:=9
Application.DisplayFullScreen = False
End Sub

Es bleibt immer was stehen oder es kommt ne Fehlermeldung. Außerdem
soll das Menü ausgeblendet werden, wenn eine andere Datei
geöffnet wird. Was mache ich falsch? Außerdem soll dieses erstellte
Menü auch als Menü für die rechte Maustaste fungieren. Hat dazu jemand
eine Idee? Ich würde mich sehr freuen.
Gruß
Andy

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

Betreff
Datum
Anwender
Anzeige
AW: Hilfe - Fehler bei Menüerstellung u. Ausblendung -
Kurt
Warum so umständlich? Blende die Menüleiste aus und zeig stattdessen deine an.
Kurt
Hilfe - Fehler bei Menüerstellung u. Ausblendung -
16.06.2004 10:41:41
Andy
Hallo Kurt,
danke aber leider liegt bei mir darin das Problem. Mit dem hier blende ich alles aus,
aber wie bekomme ich meines rein:

Sub Ausblenden()
With Application
.ScreenUpdating = False
.CommandBars("toolbar list").Enabled = False
.CommandBars("Worksheet Menu Bar").Enabled = False
.CommandBars("Cell").Enabled = False
.DisplayFormulaBar = True
.DisplayStatusBar = True
.DisplayFullScreen = True
End With
With ActiveWindow
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayWorkbookTabs = False
.DisplayHeadings = False
.WindowState = xlMaximized
End With
End Sub

Und wie bekomme ich den Rest wieder zurück beim beenden? Das schmeißt meine
hier nicht weg:

Sub Alles_herstellen()
With Application
.ScreenUpdating = False
.CommandBars("toolbar list").Enabled = True
.CommandBars("Worksheet Menu Bar").Enabled = True
.CommandBars("Cell").Enabled = True
.DisplayFormulaBar = False
.DisplayStatusBar = False
.DisplayFullScreen = False
End With
With ActiveWindow
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayWorkbookTabs = True
.DisplayHeadings = True
.WindowState = xlMaximized
End With
End Sub

Gruß
Andy
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige