Hello,
I would like to look through the bom to find the cells that contain certain strings. I then want it to add up and return the qty's column. No doubt this can be cleaner. This is what I have that seems like it works for storing the qty's in an array.
Sub qty_Array()
Dim QTYarray() As Integer
Dim size As Integer
Dim Probe As String
Dim i As String
Set swApp = Application.SldWorks
Set drawdoc = swApp.ActiveDoc
Set View = drawdoc.GetFirstView
size = 1
index = 0
ReDim QTYarray(size)
Set TableAnn = View.GetFirstTableAnnotation
Do While Not TableAnn Is Nothing
If TableAnn.Type = 2 Then '2 is the bom table type
Set Bom = TableAnn
Exit Do
End If
Set TableAnn = TableAnn.GetNext
Loop
For Row = 1 To Bom.RowCount - 1
If InStr(1, Bom.Text(Row, 1), "WR", vbBinaryCompare) Or InStr(1, Bom.Text(Row, 1), "W", vbBinaryCompare) > 1 _
Or InStr(1, Bom.Text(Row, 1), "BC", vbBinaryCompare) Or InStr(1, Bom.Text(Row, 1), "P", vbBinaryCompare) > 1 Then
MsgBox (Bom.Text(Row, 3))
QTYarray(index) = Bom.Text(Row, 3)
size = size + 1
ReDim Preserve QTYarray(size)
index = index + 1
MsgBox (QTYarray(1)) 'Next
Else
End If
Next
End Sub
QTY's are located: Bom.Text(Row, 3)
Any help would be appreciated.
