tz_seafly 发表于 2006-9-7 20:48:00

在用VBA开发时,如何在窗体上创建菜单栏呢?

在用VBA开发时,如何在窗体上创建菜单栏呢?急需帮忙解决,谢谢!

中世纪骑士 发表于 2006-9-8 10:02:00

<P>创建菜单栏这个简单的问题我替高手给你回答:<BR>Sub AddMenuItem()</P>
<P>&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; 创建新菜单<BR>&nbsp;&nbsp;&nbsp; <BR>Dim newMenu As AcadPopupMenu<BR>&nbsp;&nbsp;&nbsp; Set newMenu = currMenuGroup.Menus.Add("新菜单")<BR>添加菜单内容<BR>Dim newMenuItem As AcadPopupMenuItem<BR>&nbsp;&nbsp;&nbsp; Dim macro As String<BR>&nbsp;&nbsp;&nbsp; macro = Chr(vbKeyEscape) + Chr(vbKeyEscape)&nbsp;&nbsp;&nbsp;&nbsp; '相当于按下两次Esc键<BR>Dim menuItemOpen As AcadPopupMenuItem<BR>&nbsp;&nbsp;&nbsp; Set menuItemOpen = newMenu.AddMenuItem(newMenu.Count + 1, "打开", macro &amp; "_open ")<BR>这里写了个“打开”文件的菜单,你要做别的,改改部分代码即</P>

alin 发表于 2006-9-8 10:33:00

<P>I think he want to create menus in user forms.</P>

aipzyz 发表于 2006-10-1 16:46:00

<A name=31921><FONT color=#000066><B>中世纪骑士</B></FONT></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 可以和我联系吗?QQ:81234115
页: [1]
查看完整版本: 在用VBA开发时,如何在窗体上创建菜单栏呢?