dafei315 发表于 2007-5-26 22:02:00

[求助]vba实现cad下添加菜单!

<p>这是我编的一段代码,实现在cad下添加一个菜单项,目的是使layerclect窗体现实 但是运行不了,</p><p>红色部分肯定是有错误&nbsp; 但不知道怎么改&nbsp; 求高手指点一下下啊~~</p><p>Sub insertMenu()<br/>Dim currMenuGroup As AcadMenuGroup<br/>Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)<br/>Dim newMenu As AcadPopupMenu<br/>Set newMenu = currMenuGroup.Menus.Add("宗地检验")<br/>Dim newMenuItem As AcadPopupMenuItem<br/><font color="#ff0000">Dim jianyan As String<br/>jianyan = "layerclect.Show"</font></p><p>Set newMenuItem = newMenu.AddMenuItem(newMenu.Count + 1, "封闭性检验", <font color="#ff0000">layerclect.Show</font>)<br/>currMenuGroup.Menus.InsertMenuInMenuBar "宗地检验", ""</p><p>End Sub<br/></p>

紫色狂澜 发表于 2007-5-27 13:12:00

<p>看你发了这么久都没人回答</p><p>我告诉你吧</p><p></p><p>Sub insertMenu()<br/>Dim currMenuGroup As AcadMenuGroup<br/>Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)<br/>Dim newMenu As AcadPopupMenu<br/>Set newMenu = currMenuGroup.Menus.Add("宗地检验")<br/>Dim newMenuItem As AcadPopupMenuItem<br/>Set newMenuItem = newMenu.AddMenuItem(newMenu.Count + 1, "封闭性检验", <font color="#0000ff">"-VBARUN Show<font color="#ff0000">layerclect</font>" &amp; vbCr</font>)<br/>currMenuGroup.Menus.InsertMenuInMenuBar "宗地检验", ""</p><p>End Sub<br/></p><p>Sub <font color="#0000ff">Show</font><font color="#ff0000">layerclect()</font></p><p><font color="#ff0000">layerclect.Show</font></p><p><font color="#ff0000">End Sub</font></p><p><font color="#ff0000"></font></p><p><font color="#ff0000">菜单后的<font color="#0000ff">"-VBARUN Show</font><font color="#ff0000">layerclect</font></font><font color="#0000ff">"会发送到命令行</font></p><p><font color="#0000ff">然后运行Show<font color="#ff0000">layerclect()宏</font></font></p>

dafei315 发表于 2007-5-27 14:28:00

<p>真是好心人啊!!!!!</p><p>真该好好谢谢你!</p><p>你哪的 离我近的话请你吃饭&nbsp; 必须的!</p>

dafei315 发表于 2007-5-29 15:30:00

如果 我想在一个菜单下连续定义几个子菜单应该怎么做啊??
页: [1]
查看完整版本: [求助]vba实现cad下添加菜单!