polosm 发表于 2006-5-25 00:18:00

求助~!!~!~vba中写autocad的3级菜单!~

<P>Option Explicit<BR>Public DirPath As String</P>
<P><BR>Sub AddASubMenu()<BR>&nbsp;&nbsp;&nbsp; '获得当前的菜单组<BR>&nbsp;&nbsp;&nbsp; Dim currMenuGroup As AcadMenuGroup<BR>&nbsp;&nbsp;&nbsp; Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)<BR>&nbsp;&nbsp;&nbsp; ' 创建新菜单<BR>&nbsp;&nbsp;&nbsp; Dim newMenu As AcadPopupMenu<BR>&nbsp;&nbsp;&nbsp; Set newMenu = currMenuGroup.Menus.Add("ttttttttttttt(&amp;K)" &amp; Chr(Asc("&amp;")))<BR>&nbsp;&nbsp;&nbsp; '添加菜单项<BR>&nbsp;&nbsp;&nbsp; Dim macro As String<BR>&nbsp;&nbsp;&nbsp; macro = Chr(vbKeyEscape) + Chr(vbKeyEscape)&nbsp;&nbsp;&nbsp;&nbsp; '相当于按下两次Esc键<BR>&nbsp;&nbsp;&nbsp; '--------------------------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp; '创建知识库(&amp;C)<BR>&nbsp;&nbsp;&nbsp; Dim ID_Create&nbsp; As AcadPopupMenuItem<BR>&nbsp;&nbsp;&nbsp; Set ID_Create = newMenu.AddMenuItem(newMenu.Count + 1, Chr(Asc("&amp;")) &amp; "创建知识库(&amp;C)", macro &amp; "_open ")<BR>&nbsp;&nbsp;&nbsp; '分隔线<BR>&nbsp;&nbsp;&nbsp; Dim menuItemSeparator As AcadPopupMenuItem<BR>&nbsp;&nbsp;&nbsp; Set menuItemSeparator = newMenu.AddSeparator(newMenu.Count + 1)<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; '--------------------------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp; '知识查询(&amp;Q)<BR>&nbsp;&nbsp;&nbsp; Dim ID_Query As AcadPopupMenu<BR>&nbsp;&nbsp;&nbsp; Set ID_Query = newMenu.AddSubMenu(newMenu.Count + 1, Chr(Asc("&amp;")) &amp; "知识查询(&amp;Q)")<BR>&nbsp;&nbsp;&nbsp; '子菜单项目1:设计手册<BR>&nbsp;&nbsp;&nbsp; Dim ID_book As AcadPopupMenuItem<BR>&nbsp;&nbsp;&nbsp; Set ID_book = ID_Query.AddMenuItem(ID_Query.Count + 1, Chr(Asc("&amp;")) &amp; "设计手册(&amp;B)", macro &amp; "-vbarun" + Chr(32) + "ThisDrawing.vbahelp" + Chr(32))<BR><BR>&nbsp;&nbsp;&nbsp; ' 在菜单栏上显示菜单<BR>&nbsp;&nbsp;&nbsp; newMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.Count + 1)<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; <BR>End Sub</P>

<P>我想在 子菜单项目1:设计手册 后面在加上一个3级菜单 螺丝手册。。铸件手册。。等等</P>

<P>望会人告诉我怎么写!~!谢谢楼主!~</P>

ever-eagle 发表于 2006-5-29 18:41:00

提示:ThisDrawing.vbahelp的宏找不到!
页: [1]
查看完整版本: 求助~!!~!~vba中写autocad的3级菜单!~