It uses two of several events built into Acad VBA.
The code in the "EndCommand" event checks each entity in the selection set.
If any of them are blocks it sends an "undo" command.
The code in "SelectionChanged" event checks to see if any blocks are
selected. If so, it sends two escape characters to cancel the command.
Not a great way to do things but ...
To try it:
Type "VBAMAN" at the command line
Select the "Visual Basic Editor" button
Double click on "ThisDrawing" in the Project window
Copy and paste the code in the "Declarations" window
Gary
"A-Design"
wrote in message
news:4881381@discussion.autodesk.com...
Gary, Thanks for reply
But could you tell me how it works ? I am not professional with VBA.
Thank you.
A.K.
"Gary McMaster" wrote in message
news:4877367@discussion.autodesk.com...
If it's for use in your own office, and you can be sure that the VBA code
will be loaded and enabled ...
Here's a hack solution that may provide some protection.
Hope it helps.
Gary
Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
Dim oEntity As AcadEntity
For Each oEntity In ThisDrawing.ActiveSelectionSet
If oEntity.ObjectName = "AcDbBlockReference" Then
SendKeys "UNDO" & vbCrLf
End If
Next
End Sub
Private Sub AcadDocument_SelectionChanged()
Dim oEntity As AcadEntity
For Each oEntity In ThisDrawing.PickfirstSelectionSet
If oEntity.ObjectName = "AcDbBlockReference" Then
SendKeys Chr(27) & Chr(27)
End If
Next
End Sub