Ich hab mir ein Add-In erstellt, das eine eigene Symbolleiste mit eigenen Symbolen erstellt.
Das funktioniert einwandfrei! Hier ist das Add-In: https://www.herber.de/bbs/user/58997.xla
Das ist der Code daraus:
Private Sub Workbook_Open()
Dim CB As CommandBar
Dim CBC As CommandBarButton
Dim I As Integer
On Error Resume Next
Set CB = Application.CommandBars.Add(Name:="Meine Symbolleiste", temporary:=True, Position:= _
_
_
msoBarTop)
On Error GoTo 0
If Application.CommandBars("Meine Symbolleiste").Visible = False Then
CB.Visible = True
' Code von jinx zur Position
' RowIndex 3 --> vor Standard-Symbolleiste
' Rowindex 4 --> vor Formatsymbolleiste
CB.RowIndex = Application.CommandBars("Standard").RowIndex
' Left = 0 ---> wird vor existierende Symbolleiste eingefügt
' Left > 0 --> Wird hinter Symbolleiste angefügt
CB.Left = 0
Application.CommandBars("Formatting").Left = 0
Application.CommandBars("Standard").Left = 0
For I = 1 To 8
Set CBC = CB.Controls.Add(Type:=msoControlButton)
With CBC
' .Width = 35 ' Breite der Schalter
' .Style = msoButtonCaption ' Text auf Schaltfläche
Select Case I
Case 1
ThisWorkbook.Worksheets("Icons").Shapes("Bild 1").Copy
.Caption = "Format: Auswertung"
.OnAction = "Format_Auswertung"
.Style = msoButtonIcon
.PasteFace
Case 2
ThisWorkbook.Worksheets("Icons").Shapes("Bild 2").Copy
.Caption = "Fußzeile"
.OnAction = "Fußzeile_einfügen"
.Style = msoButtonIcon
.PasteFace
Case 3
ThisWorkbook.Worksheets("Icons").Shapes("Bild 3").Copy
.Caption = "CSV Speichern"
.OnAction = "CSV_als_XLS_Speichern"
.Style = msoButtonIcon
.PasteFace
.BeginGroup = True
Case 4
ThisWorkbook.Worksheets("Icons").Shapes("Bild 4").Copy
.Caption = "Querformat"
.OnAction = "Querformat"
.Style = msoButtonIcon
.PasteFace
.BeginGroup = True
Case 5
ThisWorkbook.Worksheets("Icons").Shapes("Bild 5").Copy
.Caption = "Seitenrand vergrößern"
.OnAction = "Seitenrand_vergroessern"
.Style = msoButtonIcon
.PasteFace
Case 6
ThisWorkbook.Worksheets("Icons").Shapes("Bild 6").Copy
.Caption = "Automatischer Seitenumbruch"
.OnAction = "Automatischer_Seitenumbruch"
.Style = msoButtonIcon
.PasteFace
.BeginGroup = True
Case 7
ThisWorkbook.Worksheets("Icons").Shapes("Bild 7").Copy
.Caption = "Als Datum"
.OnAction = "Als_DATUM_formatieren"
.Style = msoButtonIcon
.PasteFace
.BeginGroup = True
Case 8
ThisWorkbook.Worksheets("Icons").Shapes("Bild 8").Copy
.Caption = "Als TEXT/ZAHL formatieren"
.OnAction = "Als_TEXT_formatieren"
.Style = msoButtonIcon
.PasteFace
End Select
End With
Next I
End If
End Sub
Private Sub Workbook_Deactivate()
' Symbolleiste ausblenden bei Dateiwechsel
On Error Resume Next
If Application.CommandBars("Meine Symbolleiste").Visible = True Then Application. _
CommandBars("Meine Symbolleiste").Visible = False
End Sub
Private Sub Workbook_Activate()
' Symbolleiste einblenden
On Error GoTo neu ' falls jemand von Hand die Symbolleiste gelöscht hat
If Application.CommandBars("Meine Symbolleiste").Visible = False Then Application. _
CommandBars("Meine Symbolleiste").Visible = True
Exit Sub
neu: ' Symbolleiste neu erstellen
Workbook_Open
End Sub
Ich brauche jetzt aber neben den eigenen Makros in der eigenen Symbolleiste auch feste Funktionen wie z. B.
- öffnen
- speichern
- Seitenansicht
- rückgängig
- wiederholen
- kopieren
- einfügen
- ausschneiden
Wie bekomme ich diese Standard-Befehle von Office (inkl. Icons) in meine temporäre Symbolleiste!
Ich finde einfach keine Lösung zu diesem Problem.
Danke für die Hilfe!
Florian