|
在03里,指定一个命令最多只4层。
比如:工作表菜单栏 - 文件(&F) - 打印区域(&T) - 设置打印区域(&S)- Sub test1()
- Dim c, ctl, i
- Cells.Clear
- For Each c In CommandBars '命令栏
- For Each ctl In c.Controls '命令栏控件
- i = i + 1
- Cells(i, 1) = c.Index
- Cells(i, 2) = c.NameLocal
- Cells(i, 3) = ctl.Index
- Cells(i, 4) = ctl.Caption
- Next ctl
- Next c
- End Sub
- Sub test2()
- Dim c1, c2, c3, c4, i
- On Error Resume Next
- Cells.Clear
- For Each c1 In CommandBars '命令栏
- For Each c2 In c1.Controls '命令栏控件
- For Each c3 In c2.Controls
- For Each c4 In c3.Controls
- i = i + 1
- Cells(i, 1) = c1.Index
- Cells(i, 2) = c1.NameLocal
- Cells(i, 3) = c2.Index
- Cells(i, 4) = c2.Caption
- Cells(i, 5) = c3.Index
- Cells(i, 6) = c3.Caption
- Cells(i, 7) = c4.Index
- Cells(i, 8) = c4.Caption
- Next c4
- Next c3
- Next c2
- Next c1
- End Sub
复制代码 问题1:为什么test1显示“工作表菜单栏”下有“操作”;而test2无?
问题2:从test2结果看,有的结果为什么没出现在03里?
|
|