Run macro when move objects

Run macro when move objects

seabrahenrique
Advocate Advocate
732 Views
2 Replies
Message 1 of 3

Run macro when move objects

seabrahenrique
Advocate
Advocate

Hello guys…

 

It’s possible to run a macro automatically when a move some object in my model space? After move a block for example….

 

In VBA for excel I have this option… codes “running by events”….


Can we make something like that in VBA for AutoCAD?

 

Thanks in advance 🙂

0 Likes
Accepted solutions (2)
733 Views
2 Replies
Replies (2)
Message 2 of 3

MakCADD
Advocate
Advocate
Accepted solution

you can use event handler in vba

which let you run a macro when an event takes place in the document

select object AcadDocument from the dropdown list,

then you can see the available built in events in vba

0 Likes
Message 3 of 3

seabrahenrique
Advocate
Advocate
Accepted solution

Thanks @MakCADD!

 

I made a solution with your proposal and a lite bit more of codes... The final results is here:

 

 

Private Sub AcadDocument_EndCommand(ByVal CommandName As String)

 If CommandName = "MOVE" Or CommandName = "GRIP_STRETCH" Or CommandName = 
 "DROPGEOM" Then

   'CODE EXECUTION HERE

 End If

End Sub

 

 

0 Likes