小弟代码如下: Sub myhEllo() MsgBox "Hello" End Sub Sub AddMenuItemToshortcutMenu() Dim currMenuGroup As AcadMenuGroup Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(1) ' 查找快捷菜单并将其指定给 ' shortcutMenu 变量 Dim scMenu As AcadPopupMenu Dim entry As AcadPopupMenu On Error Resume Next For Each entry In currMenuGroup.Menus If entry.Name = "编辑菜单" Then Set scMenu = entry For i = entry.Count - 1 To 0 Step -1 entry.Item(i).Delete Next End If Next entry ' 向快捷菜单添加菜单项 Dim newMenuItem As AcadPopupMenuItem Dim openMacro As String 'Dim myhEllo As String ' 给宏指定“ESC ESC _open”的 VBA 等价值 'myhEllo = Chr(3) + Chr(3) + "_vbarun" & " " & "D:\Project.dvb!ThisDrawing.myhello " & Chr(13) matchpropMacro = Chr(3) + Chr(3) + "_matchprop " Set newMenuItem = scMenu.AddMenuItem("", Chr(Asc("&")) + "格式刷", matchpropMacro) Set newMenuItem = scMenu.AddMenuItem("", Chr(Asc("&")) + "公差标注", myhEllo) End Sub
问题:怎样才能使myhEllo调用我最开始定义的sub myhEllo(); 另外,如果我的sub myhEllo()定义在另外一个工程文件里面怎么调用呢? 请指教。 谢谢先 |