Option Explicit Public DirPath As String
Sub AddASubMenu() '获得当前的菜单组 Dim currMenuGroup As AcadMenuGroup Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0) ' 创建新菜单 Dim newMenu As AcadPopupMenu Set newMenu = currMenuGroup.Menus.Add("ttttttttttttt(&K)" & Chr(Asc("&"))) '添加菜单项 Dim macro As String macro = Chr(vbKeyEscape) + Chr(vbKeyEscape) '相当于按下两次Esc键 '-------------------------------------------------------------------------------------- '创建知识库(&C) Dim ID_Create As AcadPopupMenuItem Set ID_Create = newMenu.AddMenuItem(newMenu.Count + 1, Chr(Asc("&")) & "创建知识库(&C)", macro & "_open ") '分隔线 Dim menuItemSeparator As AcadPopupMenuItem Set menuItemSeparator = newMenu.AddSeparator(newMenu.Count + 1) '-------------------------------------------------------------------------------------- '知识查询(&Q) Dim ID_Query As AcadPopupMenu Set ID_Query = newMenu.AddSubMenu(newMenu.Count + 1, Chr(Asc("&")) & "知识查询(&Q)") '子菜单项目1:设计手册 Dim ID_book As AcadPopupMenuItem Set ID_book = ID_Query.AddMenuItem(ID_Query.Count + 1, Chr(Asc("&")) & "设计手册(&B)", macro & "-vbarun" + Chr(32) + "ThisDrawing.vbahelp" + Chr(32))
' 在菜单栏上显示菜单 newMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.Count + 1) End Sub
我想在 子菜单项目1:设计手册 后面在加上一个3级菜单 螺丝手册。。铸件手册。。等等
望会人告诉我怎么写!~!谢谢楼主!~ |