Message 1 of 4
More block attributes help
Not applicable
06-17-2005
08:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can someone please help me with this?
For some reason this code works most of the time, but ocassionally when I
run it I get a "Subscript out of range" error. The error is ocurring on the
line
"attr(1).TextString = UserForm1.TextBox4.Text".
I can't figure out why.
Graeme
For j = 0 To dwg.ModelSpace.Count - 1
' call acad entites variable ent
Set Ent = dwg.ModelSpace.Item(j)
' If ent is a block then call it variable blkREF
If TypeOf Ent Is AcadBlockReference Then
If Left(Ent.Name, 13) = "name1" Or Ent.Name = "name2" Then
Set blkREF = Ent
attr = blkREF.GetAttributes
If attr(0).TextString = UserForm1.TextBox1.Text Then
If attr(1).TextString = UserForm1.TextBox2.Text Then
attr(0).TextString = UserForm1.TextBox3.Text
attr(1).TextString = UserForm1.TextBox4.Text
End If
End If
End If
'If Not Ent.ObjectName = "AcDbBlockReference" Then
'Set blkREF = Nothing
'End If
End If
Next j
For some reason this code works most of the time, but ocassionally when I
run it I get a "Subscript out of range" error. The error is ocurring on the
line
"attr(1).TextString = UserForm1.TextBox4.Text".
I can't figure out why.
Graeme
For j = 0 To dwg.ModelSpace.Count - 1
' call acad entites variable ent
Set Ent = dwg.ModelSpace.Item(j)
' If ent is a block then call it variable blkREF
If TypeOf Ent Is AcadBlockReference Then
If Left(Ent.Name, 13) = "name1" Or Ent.Name = "name2" Then
Set blkREF = Ent
attr = blkREF.GetAttributes
If attr(0).TextString = UserForm1.TextBox1.Text Then
If attr(1).TextString = UserForm1.TextBox2.Text Then
attr(0).TextString = UserForm1.TextBox3.Text
attr(1).TextString = UserForm1.TextBox4.Text
End If
End If
End If
'If Not Ent.ObjectName = "AcDbBlockReference" Then
'Set blkREF = Nothing
'End If
End If
Next j