|
楼主 |
发表于 2018-7-29 21:45
|
显示全部楼层
Sub CommandbarsListing()
Application.ScreenUpdating = False
On Error Resume Next
Dim oCbar As Object
Dim intRowNum As Integer
intRowNum = 1
Dim oSht As Object
Set oSht = ThisWorkbook.Worksheets("工具栏菜单项")
With oSht
.Cells(intRowNum, 1) = "Index"
.Cells(intRowNum, 2) = "Name"
.Cells(intRowNum, 3) = "NameLocal"
.Cells(intRowNum, 4) = "Type"
.Cells(intRowNum, 5) = "Position"
.Cells(intRowNum, 6) = "Proteciton"
.Cells(intRowNum, 7) = "Top"
.Cells(intRowNum, 8) = "Left"
.Cells(intRowNum, 9) = "Width"
.Cells(intRowNum, 10) = "Height"
.Cells(intRowNum, 11) = "Index"
.Cells(intRowNum, 12) = "Type"
.Cells(intRowNum, 13) = "Type"
.Cells(intRowNum, 14) = "ID"
.Cells(intRowNum, 15) = "Caption"
.Cells(intRowNum, 16) = "DescriptionText"
.Cells(intRowNum, 17) = "OnAction"
.Cells(intRowNum, 18) = "Parameter"
.Cells(intRowNum, 19) = "Parent"
.Cells(intRowNum, 20) = "Tag"
End With
intRowNum = intRowNum + 1
For Each oCbar In Application.CommandBars
If oCbar.BuiltIn Then
With oSht
.Cells(intRowNum, 1) = oCbar.Index
.Cells(intRowNum, 2) = oCbar.Name
.Cells(intRowNum, 3) = oCbar.NameLocal
.Cells(intRowNum, 4) = oCbar.Type
.Cells(intRowNum, 5) = oCbar.Position
.Cells(intRowNum, 6) = oCbar.Protection
.Cells(intRowNum, 7) = oCbar.Top
.Cells(intRowNum, 8) = oCbar.Left
.Cells(intRowNum, 9) = oCbar.Width
.Cells(intRowNum, 10) = oCbar.Height
End With
For Each oCtrl In oCbar.Controls
If oCtrl.BuiltIn Then
With oSht
.Cells(intRowNum, 11) = oCtrl.Index
.Cells(intRowNum, 12) = oCtrl.Type
.Cells(intRowNum, 13) = strMsoControlType(oCtrl.Type)
.Cells(intRowNum, 14) = oCtrl.ID
.Cells(intRowNum, 15) = oCtrl.Caption
.Cells(intRowNum, 16) = oCtrl.DescriptionText
.Cells(intRowNum, 17) = oCtrl.OnAction7
.Cells(intRowNum, 18) = oCtrl.Parameter
.Cells(intRowNum, 19) = oCtrl.Parent
.Cells(intRowNum, 20) = oCtrl.Tag
End With
End If
intRowNum = intRowNum + 1
Next oCtrl
End If
Next oCbar
Call ColumnsAutofiting
Application.ScreenUpdating = True
Application.Goto oSht.Range("a1"), True
End Sub
|
|