I have been using varAttribs(intI).LockPosition = False in the follow code to try to make attributes movable in a block
referece without any luck. Is there any way to use vba to make attributes movable in a block?
public Sub TestGetAttributes()
Dim varPick As Variant
Dim objEnt As AcadEntity
Dim objBRef As AcadBlockReference
Dim varAttribs As Variant
Dim strAttribs As String
Dim intI As Integer
On Error Resume Next
'' get an entity from user
.GetEntity objEnt, varPick, vbCr & "Pick a block with attributes: "
If Err Then Exit Sub
'' cast it to a blockref
Set objBRef = objEnt
'' exit if not a block
If objBRef Is Nothing Then
.Prompt vbCr & "That wasn't a block."
'' exit if it has no attributes
If Not objBRef.HasAttributes Then
.Prompt vbCr & "That block doesn't have attributes."
'' get the attributerefs
varAttribs = objBRef.GetAttributes
'' show some information about each
strAttribs = "Block Name: " & objBRef.Name & vbCrLf
For intI = LBound(varAttribs) To UBound(varAttribs)
strAttribs = strAttribs & " Tag(" & intI & "): " & _
varAttribs(intI).TagString & vbTab & " Value(" & intI & "): " & _
varAttribs(intI).TextString & vbCrLf
'Does not work
varAttribs(intI).LockPosition = False
Solved! Go to Solution.
so i checked in the base of acad . (F2 in vba) and try to look for lockposition in then acadattributreference --> it is read only.
so you cant change if you use a attributreférence of block
you need tou use with AcadAttribut if you want modify.
AubelecBE is right you can't edit this property in place. I attach one solution. Procedure change LockPosition propertie and then update each block, inserted in drawing.
in this prog. you have to add the proc for check if the bloc is not a Xref and if the attribut can modif.
and one more thing : you can't use it for the bloc dynamic.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register