Okay, my explanation was not good enough, sorry for that.
So here another try 🙂
I created a block (in this case for a revision note), in VBA
Sub rev_block()
Dim blockn_name As String
Dim blockObj As AcadBlock
Dim insertionPnt(0 To 2) As Double
Dim Line_Points(0 To 5) As Double
Dim draw_Poly As AcadLWPolyline
Dim returnPnt As Variant
Dim blockRefObj As AcadBlockReference
Dim typeFace As String
Dim SavetypeFace As String
Dim Bold As Boolean
Dim Italic As Boolean
Dim charSet As Long
Dim PitchandFamily As Long
Dim height As Double
Dim mode As Long
Dim prompt1 As String
Dim insertionPoint1(0 To 2) As Double
Dim tag1 As String
Dim value As String
insertionPnt(0) = 0: insertionPnt(1) = 0: insertionPnt(2) = 0
block_name = "REV"
Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, block_name)
Line_Points(0) = 0: Line_Points(1) = 0
Line_Points(2) = 7: Line_Points(3) = 0
Line_Points(4) = 3.5: Line_Points(5) = 6
Set draw_Poly = blockObj.AddLightWeightPolyline(Line_Points)
draw_Poly.Closed = True
'Save the actual textstyle
ThisDrawing.ActiveTextStyle.GetFont typeFace, Bold, Italic, charSet, PitchandFamily
SavetypeFace = typeFace
'set new style
typeFace = "ISOCPEUR"
ThisDrawing.ActiveTextStyle.SetFont typeFace, Bold, Italic, charSet, PitchandFamily
ThisDrawing.Regen acActiveViewport
height = 3.5
mode = acAttributeModeVerify
prompt1 = "REVISION"
insertionPoint1(0) = insertionPnt(0) + 2.5: insertionPoint1(1) = insertionPnt(1) + 1: insertionPoint1(2) = 0
tag1 = "REVISIION"
value = "1"
Set attributeObj = blockObj.AddAttribute(height, mode, prompt1, insertionPoint1, tag1, value)
returnPnt = ThisDrawing.Utility.GetPoint
insertionPnt(0) = returnPnt(0)
insertionPnt(1) = returnPnt(1)
insertionPnt(2) = 0
Set blockRefObj = ThisDrawing.PaperSpace.InsertBlock(insertionPnt, block_name, 1#, 1#, 1#, 0)
ThisDrawing.ActiveTextStyle.SetFont SavetypeFace, Bold, Italic, charSet, PitchandFamily
ThisDrawing.Regen acActiveViewport
End SubThis code works, once.
If I run it a 2nd time I get an message "lock violation".
If I run this code, use another command and run this code again, I get the same error-message.
If I run this code, switch to another drawing, switch back to the first drawing run this code again, I can insert the block a 2nd time.
I can implement a check for the block, so I'll get a notification that the block already exists, but my target is to insert this block as many times as I want, because I need this block several times on the drawing, but I don't know how to get this done :o/