Unable to loop over GetAttributes in VBScript, but works in VBA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have changed the below VBA code to VBScript. The code in VBScript fails to iterate over the atts variable (line highlighted in Red), but is working fine in VBA.
Has anyone had this issues over looping the GetAttributes object? Please advise and appreciate your support.
VBA Code:
Private Sub UpdateAttribute(blk As AcadBlockReference, attTag As String, attValue As String)
Dim atts As Variant
Dim i As Integer
Dim att As AcadAttributeReference
atts = blk.GetAttributes
For i = LBound(atts) To UBound(atts)
Set att = atts(i)
If UCase(att.TagString) = UCase(attTag) Then
att.textString = attValue
End If
Next
End Sub
VB-Script Code:
Sub UpdateAttribute(blk, attTag, attValue)
Dim atts
Dim i
Dim att
atts = blk.GetAttributes
For i = LBound(atts) To UBound(atts)
Set att = atts(i)
If UCase(att.TagString) = UCase(attTag) Then
att.textString = attValue
End If
Next
End Sub
Thanks,
Rama