AW: @Reinhard
17.04.2012 13:04:57
Reinhard
Hallo Dieter,
ich hatte weiter dran probiert aber da ist noch der Wurm drin. Irgendwie ist alles auf dem Blatt *glaub*
aber an falschen Stellen
teste bitte selbst den nachfolgenden Code, dann siehste es.
Gruß
Reinhard
Public Sub machs()
Dim objControl As CommandBarControl, btn
Dim Zei As Long, Spa As Long, Pos As Integer, Z
On Error Resume Next
Application.ScreenUpdating = False
With Worksheets("Tabelle1")
.UsedRange.Clear
Zei = 1
Spa = -1
For Each objControl In Application.CommandBars("Worksheet Menu Bar").Controls
Spa = Spa + 2
.Cells(Zei, Spa).Value = Replace(objControl.Caption, "&", "")
.Cells(Zei, Spa).Font.Bold = True
For Each btn In objControl.Controls
If btn.Visible Then
Zei = Zei + 1
With .Cells(Zei, Spa)
.Value = btn.Caption
For Z = 1 To btn.Controls.Count
.Offset(Z - 1, Spa).Value = btn.Caption
.Offset(Z - 1, Spa + 1).Value = btn.Controls(Z).Caption
Next Z
Zei = Zei + Z
Pos = InStr(1, .Text, "&")
.Replace "&", ""
If Pos > 0 Then .Characters(Pos, 1).Font.Bold = True
If btn.Enabled = False Then .Font.Strikethrough = True
End With
End If
Next
Zei = 1
Next
.Columns.AutoFit
End With
Application.ScreenUpdating = True
End Sub
Sub tt()
MsgBox CommandBars("Worksheet Menu Bar").Controls("Forma&t").Controls("Spa<e").Controls("Einb&lenden").Enabled
MsgBox CommandBars("Worksheet Menu Bar").Controls("Forma&t").Controls("Spa<e").Controls.Count
End Sub