0 Replies Latest reply on Dec 3, 2015 4:14 PM by Oskars Milbergs

    Deleting rows from BOM

    Oskars Milbergs

      I am currently trying to make macro for my bom table. Aim is after table selection to delete rows from bom where text into nine column is "No".  I tried to run the code but it keeps telling me that for nNumRow array is expected. Could anyone help me with the code?





      Dim swApp As SldWorks.SldWorks

      Dim swModel As SldWorks.ModelDoc

      Dim swSelMgr As SldWorks.SelectionMgr

      Dim swView As SldWorks.View

      Dim swBomTableAnn As SldWorks.BomTableAnnotation

      Dim i As Integer

      Dim swTableAnn As SldWorks.TableAnnotation

      Dim nNumRow As Long



      Sub main()

          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swSelMgr = swModel.SelectionManager

          Set swBOMTable = swSelMgr.GetSelectedObject5(1)


      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