- Sub test()
- Dim PMObj As AcadPopupMenu
- Dim PMItemObj As AcadPopupMenuItem
- ' 遍历菜单栏
- For Each PMObj In Application.MenuBar
- ' 遍历下拉菜单
- For Each PMItemObj In PMObj
- ' 如果菜单项的类型是菜单项(其它类型为分隔条、子菜单)
- If PMItemObj.Type = acMenuItem Then
- ' 如果菜单项是“新建”菜单项
- If PMItemObj.TagString = "ID_New" Then
- '变灰
- PMItemObj.Enable = False
- ' 如果菜单项是“打开”菜单项
- ElseIf PMItemObj.TagString = "ID_Open" Then
- '选中
- PMItemObj.Check = True
- End If
- End If
- Next
- Next
- Set PMItemObj = Nothing
- Set PMObj = Nothing
- End Sub
|