AnsweredAssumed Answered

Delete BOM rows

Question asked by Oskars Milbergs on Dec 4, 2015

I am currently trying to make macro which could filter my bom table, but it keeps getting error messages. The goal is to delete all rows which contains text "No" in 9 column, could anyone help me with this?

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc

Dim swSelMgr As SldWorks.SelectionMgr

Dim swView As SldWorks.View

Dim swBomTable As SldWorks.BomTableAnnotation

Dim i As Integer

Dim swTableAnn As SldWorks.TableAnnotation

Dim nNumRow As Variant


Sub main()

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swSelMgr = swModel.SelectionManager

    Set swBomTable = swSelMgr.GetSelectedObject5(1)

    Set swTableAnn = swBomTable




For i = swTableAnn.RowCount - 1 To 0 Step -1

   nNumRow = swBomTable.GetIdForRowNumber(i)


     If nNumRow(i, 9) = "No" Then

   swBomTable.Deleterow (nNumRow), True

     End If

     Next i


End Sub