论坛里有不少方法,我用的是:
把下面代码放到thisdrawing中,
- Public testLoad As Boolean
- Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
- If Not testLoad Then
- testLoad = True
- MacroToCommand "WBN", "pileNo.dvb!thisdrawing.pileno" '宏的命令名和宏的位置。
- End If
- End Sub
- Public Sub MacroToCommand(ByVal cmdName As String, ByVal macroName As String)
- Dim string1 As String
- string1 = "(defun c:" & cmdName & " () (command " & Chr(34) & "-vbarun" & Chr(34) & " " & Chr(34) & macroName & Chr(34) & ")) "
- ThisDrawing.SendCommand string1
- End Sub
|