View Single Post
  #8   Report Post  
TimLeonard TimLeonard is offline
Member
 
Posts: 46
Default

Quote:
I'm curious as to whether or not you can simply load the attributes
into an array and 'dump' the array into a blank worksheet like this...

XlSheet.Cells(1).Resize(Ubound(Array1), Ubound(Array1, 2)) = Array1

...which assumes Array1 becomes a 2D array after the attributes are
loaded into it!
I'm not exactly sure where to place it but I tried it in several locations and it gives an error message "Subscript out of range" in each


However the following does array in 2D
Dim vAttrData
vAttrData = XlSheet.UsedRange

So I been trying to figure out how to grab it and sent it back in to autocad.. Anyways I need to do a lot more reading up on this...
Code:
         For i = LBound(newAttribs) To UBound(newAttribs)
           For Count = LBound(newAttribs) + 2 To UBound(newAttribs) + 2
             If blkEntity.handle = vAttrData(Count, 1) Then
                  
                  Select Case newAttribs(i).TagString
'                  Case "HANDLE"
'                     handle = newAttr.TextString
                  Case "TAG"
                      newAttribs(i).TextString = vAttrData(Count, 2).TextString
                  Case "LOOP"
                      tmpAttr(2) = vAttrData(Count, 3).TextString
                  Case "ADDRESS"
                      tmpAttr(3) = vAttrData(Count, 4).TextString
                  Case "LABEL1"
                      tmpAttr(4) = vAttrData(Count, 5).TextString
                  Case "LABEL2"
                      tmpAttr(5) = vAttrData(Count, 6).TextString
                  Case "DEVICE_LABEL"
                      tmpAttr(6) = vAttrData(Count, 7).TextString
                  Case "EXTENDED_LABEL"
                      tmpAttr(7) = vAttrData(Count, 8).TextString
                  Case "QTY"
                      tmpAttr(8) = vAttrData(Count, 9).TextString
                  Case "MODEL_NUM"
                      tmpAttr(9) = vAttrData(Count, 10).TextString
                  Case "DESCRIPTION"
                      tmpAttr(10) = vAttrData(Count, 11).TextString
                  Case "VENDOR"
                      tmpAttr(11) = vAttrData(Count, 12).TextString
                  Case "CSFM_NUM"
                      tmpAttr(12) = vAttrData(Count, 13).TextString
  
                  End Select
               End If
            Next Count
         Next i
             AttrData.Add tmpAttr   'Entity(i).Update
      End If
      End If
    Next Entity