[求助]右键怎样调用已定义的宏
<p>小弟代码如下:</p><p>Sub myhEllo()<br/> <br/> MsgBox "Hello"<br/> <br/>End Sub</p><p>Sub AddMenuItemToshortcutMenu()<br/> Dim currMenuGroup As AcadMenuGroup<br/> Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(1)</p><p> ' 查找快捷菜单并将其指定给<br/> ' shortcutMenu 变量<br/> Dim scMenu As AcadPopupMenu<br/> Dim entry As AcadPopupMenu<br/> <br/> On Error Resume Next<br/> <br/> For Each entry In currMenuGroup.Menus <br/> <br/> If entry.Name = "编辑菜单" Then<br/> Set scMenu = entry<br/> <br/> For i = entry.Count - 1 To 0 Step -1 <br/> <br/> entry.Item(i).Delete<br/> <br/> Next <br/> <br/> End If</p><p> Next entry</p><p> ' 向快捷菜单添加菜单项<br/> Dim newMenuItem As AcadPopupMenuItem<br/> Dim openMacro As String<br/> 'Dim myhEllo As String<br/> <br/> ' 给宏指定“ESC ESC _open”的 VBA 等价值<br/> 'myhEllo = Chr(3) + Chr(3) + "_vbarun" & " " & "D:\Project.dvb!ThisDrawing.myhello " & Chr(13)<br/> matchpropMacro = Chr(3) + Chr(3) + "_matchprop "</p><p> Set newMenuItem = scMenu.AddMenuItem("", Chr(Asc("&")) + "格式刷", matchpropMacro)<br/> <br/> <font size="4"><u>Set newMenuItem = scMenu.AddMenuItem("", Chr(Asc("&")) + "公差标注", <font color="#ff0000">myhEllo</font>)</u></font> <br/> <br/> <br/>End Sub<br/></p><p>问题:怎样才能使<font color="#ff0000" size="4"><u>myhEllo</u><font size="1"><font color="#000000">调用我最开始定义的sub myhEllo();</font></font></font></p><p><font size="1">另外,如果我的sub myhEllo()定义在另外一个工程文件里面怎么调用呢?</font></p><p><font size="1">请指教。</font></p><p><font size="1">谢谢先</font></p> 本帖最后由 作者 于 2008-11-17 21:30:14 编辑 <br /><br /> <p>用下面这种方法已调试成功,但总觉得很别扭:为什么我是在同一模块里定义的宏不能相互直接调用,还必须得借用lisp调用!?</p><p>请赐教。</p><p></p>
页:
[1]