![]() |
|
Tipp 0157
|
Face-Ids der CommandBarButtons
|
 |
|
Autor/Einsender: Datum: |
|
Hakan Bode 09.11.2001 |
|
| Entwicklungsumgebung: |
|
Excel 97 |
|
|
|
Mit diesem Beispiel wird eine Symbolleiste erstellt, die alle in Excel zur Verfügung stehenden Face-Ids der Schaltflächen-Steuerelemente
(CommandBarButton) für Symbolleisten beinhaltet. Je nach Rechner-Leistung kann die Erstellung der Symbolleiste längere Zeit in Anspruch nehmen!
|
|
| |
Option Explicit
Const cBarName As String = "FaceIds-CommandBarButtons"
Sub SymbolleisteErstellen()
Dim cBar As CommandBar
Dim cBarButton As CommandBarButton
Dim cBarPopUp As CommandBarPopup
Dim IdNummer As Integer
Dim j As Integer
Dim i As Integer
For Each cBar In Application.CommandBars
If cBar.Name = cBarName Then GoTo ende
Next
Set cBar = CommandBars.Add _
(Name:=cBarName, Position:=msoBarTop, Temporary:=True)
cBar.Visible = True
IdNummer = -249
For j = 1 To 15
Set cBarPopUp = cBar.Controls.Add(Type:=msoControlPopup)
IdNummer = IdNummer + 250
With cBarPopUp
.Caption = "ID : " & IdNummer & " - " & IdNummer + 249
End With
For i = IdNummer To IdNummer + 249
Set cBarButton = cBarPopUp.Controls.Add _
(Type:=msoControlButton, Id:=2950)
With cBarButton
.Style = msoButtonIconAndCaption
.Caption = "ID : " & i
.FaceId = i
End With
Next i
Next j
Set cBarPopUp = Nothing
Set cBarButton = Nothing
Set cBar = Nothing
Exit Sub
ende:
MsgBox "Die Symbolleiste " & cBarName & " existiert bereits.", _
vbOKOnly + vbInformation, Title:=cBarName
CommandBars(cBarName).Visible = True
End Sub
|
|
|
|
|
|
Die im Download befindliche *.bas-Datei kann in Excel im VB-Editor importiert werden.
|
|
| Windows-Version |
| 95 |
 |
|
| 98/SE |
 |
|
| ME |
 |
|
| NT |
 |
|
| 2000 |
 |
|
| XP |
 |
|
| Vista |
 |
|
| Win
7 |
 |
|
|
| Excel-Version |
| 95 |
 |
|
| 97 |
 |
|
| 2000 |
 |
|
| 2002
(XP) |
 |
|
| 2003 |
 |
|
| 2007 |
 |
|
| 2010 |
 |
|
|
|
Download (1,6 kB)
|
Downloads bisher: [ 1401 ]
|
|
|