Hallo,
Ich hab einige fragen,
Ich möchte meine Benutzeroberfläsche von Excel für eine einzige datei ändern.
Klappt sogar, allerdings hab ich da ein paar kleine erweiterungen oder probleme.
Application.ScreenUpdating = False
On Error Resume Next 'in case the menu item has already been deleted
Application.CommandBars("Worksheet Menu Bar").Controls("Personal Management").Delete 'delete the menu item
Application.CommandBars("Worksheet Menu Bar").Controls("Turnover").Delete 'delete the menu item
Application.CommandBars("Worksheet Menu Bar").Controls("Einstellungen").Delete 'delete the menu item
Application.CommandBars("Worksheet Menu Bar").Controls("Arbeitserlaubniss").Delete 'delete the menu item
Application.CommandBars("Worksheet Menu Bar").Controls("Hilfe").Delete 'delete the menu item
Dim cmbBar As CommandBar
Dim cmbControl As CommandBarControl
Set cmbBar = Application.CommandBars("Worksheet Menu Bar")
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlButton, Temporary:=True) 'adds a menu item to the Menu Bar
With cmbControl
.Caption = "Personal Management" 'names the menu item
.OnAction = "TABELLENBLATT1" 'runs the specified macro
.Style = msoButtonCaption
.TooltipText = "Zur bearbeitung von Personal Daten."
.Tag = "Personal Management"
End With
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlButton, Temporary:=True) 'adds a menu item to the Menu Bar
With cmbControl
.Caption = "Turnover" 'names the menu item
.OnAction = "TABELLENBLATT2" 'runs the specified macro
.Style = msoButtonCaption
.TooltipText = "Zur erstellung vom Turnover."
.Tag = "Turnover"
End With
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlButton, Temporary:=True) 'adds a menu item to the Menu Bar
With cmbControl
.Caption = "Einstellungen" 'names the menu item
.OnAction = "TABELLENBLATT3" 'runs the specified macro
.Style = msoButtonCaption
.TooltipText = "Firmen bezogene Einstellungen ändern."
.Tag = "Einstellungen"
End With
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlButton, Temporary:=True) 'adds a menu item to the Menu Bar
With cmbControl
.Caption = "Arbeitserlaubniss" 'names the menu item
.OnAction = "TABELLENBLATT4" 'runs the specified macro
.Style = msoButtonCaption
.TooltipText = "Zur bearbeitung Eu-Länder."
.Tag = "Arbeitserlaubniss"
End With
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlButton, Temporary:=True) 'adds a menu item to the Menu Bar
With cmbControl
.Caption = "Ein/Ausloggen" 'names the menu item
.OnAction = "TABELLENBLATT2" 'runs the specified macro
.Style = msoButtonCaption
.TooltipText = "Um Den Bediener zuwechseln."
.Tag = "Ein/Ausloggen"
End With
Set cmbControl = cmbBar.Controls.Add(Type:=msoControlPopup, Temporary:=True) 'adds a menu item to the Menu Bar
With cmbControl
.BeginGroup = True
.Caption = "Hilfe" 'names the menu item
.TooltipText = "Bei Fragen und Probleme."
.Tag = "Hilfe"
With .Controls.Add(Type:=msoControlButton) 'adds a dropdown button to the menu item
.Caption = "Kontakt Infos" 'adds a description to the menu item
.OnAction = "RunMyMacro1" 'runs the specified macro
.FaceId = 568 'assigns an icon to the dropdown
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "Email"
.OnAction = "RunMyMacro2"
.FaceId = 3738
End With
With .Controls.Add(Type:=msoControlButton)
.Caption = "FAQ"
.OnAction = "RunMyMacro2"
.FaceId = 3998
End With
End With
With Application
.CommandBars("Worksheet Menu Bar").Controls("Datei").Visible = False
.CommandBars("Worksheet Menu Bar").Controls("Bearbeiten").Visible = False
.CommandBars("Worksheet Menu Bar").Controls("Ansicht").Visible = False
.CommandBars("Worksheet Menu Bar").Controls("Einfügen").Visible = False
.CommandBars("Worksheet Menu Bar").Controls("Format").Visible = False
.CommandBars("Worksheet Menu Bar").Controls("Extras").Visible = False
.CommandBars("Worksheet Menu Bar").Controls("Daten").Visible = False
.CommandBars("Worksheet Menu Bar").Controls("Fenster").Visible = False
.CommandBars("Worksheet Menu Bar").Controls("?").Visible = False
.CommandBars("Standard").Visible = False
.CommandBars("Formatting").Visible = False
.CommandBars("Control Toolbox").Visible = False
.CommandBars("Drawing").Visible = False
.DisplayFormulaBar = False
.DisplayStatusBar = False
End With
ActiveWindow.DisplayHorizontalScrollBar = False
ActiveWindow.DisplayWorkbookTabs = False
Application.ScreenUpdating = True
dieser Code entfernt alle Symbolleisten und Menu bars und erstellet für mich dann ein neues menu. soweit so gut
jedoch hab ich das problem, das jedesmal wenn ich die datei starte muss er erst die prozedur durch führen. ich mach es über Private Sub Workbook_Open()
und das dauert immer und sieht einfach blöd aus wenn die icons erst da sind und dann nach einnander verschwinden.
Meine datei macht alle einstellung immer wieder rückgänge befor_Close damit ich die einstellung nicht bei andern Excel dateien habe.
Meine frage (tut mir leid das sie erst jetzt kommt) ist ob es möglich ist diese informationen direkt in die datei zu laden so das er automatisch alles läd anstatt erst excel und dann mit Workbook_Open die einstellung läd.
Gruß
Leo