|
比如明明有13个字符串,但是,使用ubound出来只有12个,不知道为啥?所以只好用数字来指定单元格区域了。
Sub test()
Dim k As Integer
Dim cbar As CommandBar
Worksheets("工具栏").UsedRange.ClearContents
tt = Array("name", "namelocal", "index", "type", "type", "type", "height", "width", "builtin", "left", "top", "position", "visible")
Range("a1").Resize(1, 13).Value = tt
For Each cbar In CommandBars
With Worksheets("工具栏")
.Cells(k + 2, 1) = cbar.Name
.Cells(k + 2, 2) = cbar.NameLocal
.Cells(k + 2, 3) = cbar.Index
.Cells(k + 2, 4) = IIf(cbar.Type = 1, "菜单栏", IIf(cbar.Type = 0, "默认菜单栏", "快捷菜单"))
.Cells(k + 2, 5) = IIf(cbar.Type = 1, "msoBarTypeMenuBar", IIf(cbar.Type = 0, "msoBarTypeNormal", "msoBarTypePopup"))
.Cells(k + 2, 6) = cbar.Type
.Cells(k + 2, 7) = cbar.Height
.Cells(k + 2, 8) = cbar.Width
.Cells(k + 2, 9) = cbar.BuiltIn
.Cells(k + 2, 10) = cbar.Left
.Cells(k + 2, 11) = cbar.Top
.Cells(k + 2, 12) = cbar.Position
.Cells(k + 2, 13) = cbar.Visible
.Cells(k + 2, 13) = cbar.Enabled
End With
k = k + 1
Next cbar
End Sub
|
|