Unable to loop over GetAttributes in VBScript, but works in VBA

Unable to loop over GetAttributes in VBScript, but works in VBA

Anonymous
Not applicable
554 Views
0 Replies
Message 1 of 1

Unable to loop over GetAttributes in VBScript, but works in VBA

Anonymous
Not applicable

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

 

 

0 Likes
555 Views
0 Replies
Replies (0)