用VBA编缉的菜单加载程序,就是在菜单的最后增加一个菜单项,在04中加载成功了,但在06中,不但未成功,原来的菜单项还少了许多。简单代码如下: Public Sub acad() '为工程创建下拉菜单 Dim newmenugroup As AcadMenuGroup Dim newmenu As AcadPopupMenu Dim submenu1(10) As AcadPopupMenuItem Dim newmenuitem(10) As AcadPopupMenu Dim macrostr(10) As String '定义下拉菜单群组 Set newmenugroup = ThisDrawing.Application.MenuGroups.Item(0) '创建新下拉菜单 Set newmenu = newmenugroup.Menus.Add("W M C" + Chr(Asc("&")) + "Y") '定义宏 macrostr(0) = Chr(3) & Chr(3) & "-vbarun" + Chr(32) + "a1" + Chr(32) '打开sawk窗口 macrostr(1) = Chr(3) & Chr(3) & "-vbarun" + Chr(32) + "a1" + Chr(32) '创建下拉菜单 Set newmenuitem(0) = newmenu.AddSubMenu(newmenu.Count + 1, "SAW") Set newmenuitem(1) = newmenu.AddSubMenu(newmenu.Count + 2, "SWAW") Set newmenuitem(2) = newmenu.AddSubMenu(newmenu.Count + 3, "GMAW") Set submenu1(0) = newmenu.Item(0).SubMenu.AddMenuItem(0, "Single Vee", macrostr(0)) Set submenu1(1) = newmenu.Item(0).SubMenu.AddMenuItem(1, "Bouble Vee", macrostr(1)) '插入下拉菜单项 newmenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.Count + 1) End Sub 望高手指教。 |