各位老大:上次我请教了这个问题,仍是不得其解,帮忙再看一下,如下是我自定义的菜单:
Sub AddExtMenu() On Error Resume Next
'获得当前菜单组 Dim currMenuGroup As AcadMenuGroup Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0) '创建新菜单 Dim newMenu As AcadPopupMenu Set newMenu = currMenuGroup.Menus.Add("mynewmenu" & Chr(Asc("&")) & "P") '添加菜单项 Dim macro As String macro = Chr(vbKeyEscape) + Chr(vbKeyEscape) Dim menuItemOpen As AcadPopupMenuItem '在菜单中调用宏 Set menuItemOpen = newMenu.AddMenuItem(newMenu.Count + 1, Chr(Asc("&")) & "myprogram", macro & "-vbarun" + Chr(32) + "E:/other/VBA/project.dvb!Area.test" + Chr(32))
'在菜单栏上显示菜单 newMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.Count + 1)
'释放对象 Set currMenuGroup = Nothing Set newMenu = Nothing Set menuItemOpen = Nothing
End Sub
1、怎样修改才能在CAD中利用“回车”来重复响应,从而重复执行调用的E:/other/VBA/project.dvb!Area.test宏?
2、E:/other/VBA/project.dvb!Area.test宏可否改成相对路径,且仍能找到宏test?(test宏在Area模块里)
听说可以用LISP调用宏,可是我不知如何使用,找便了明经也没有合适的例子。可否赐教!谢谢。 |