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