4 Replies Latest reply on Oct 10, 2018 3:12 AM by MIRCO BIGAL

    macro to rename bill of materials

    MIRCO BIGAL

      Good morning, I created a macro that I'm going to export the bill of materials, as a tile always rename it with a specific name ?

       

      Dim swApp As Object

      Dim Part As Object

      Dim boolstatus As Boolean

      Dim longstatus As Long, longwarnings As Long

       

      Sub main()

       

      Set swApp = _

      Application.SldWorks

       

       

      Set Part = swApp.ActiveDoc

      Part.ClearSelection2 True

      Dim swActiveView As Object

      Set swActiveView = Part.ActiveDrawingView

      Dim swBOMTable As Object

      Set swBOMTable = swActiveView.InsertBomTable2(False, -1.95689826589595E-02, 0.239732219653179, swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_TopLeft, swBomType_e.swBomType_Indented, "Default", "C:\Users\Utente\Desktop\bom-standard.sldbomtbt")

      boolstatus = Part.EditRebuild3()

      End Sub

        • Re: macro to rename bill of materials
          Fifi Riri

          Hello, try this to rename the BOM title:

           

          Dim swApp As SldWorks.SldWorks

          Dim Part As SldWorks.DrawingDoc

          Dim swActiveView As SldWorks.View

          Dim swBOMTable As SldWorks.TableAnnotation

          Sub main()

          Set swApp = Application.SldWorks

          Set Part = swApp.ActiveDoc

          Set swActiveView = Part.ActiveDrawingView

          Set swBOMTable = swActiveView.InsertBomTable2(False, -1.95689826589595E-02, 0.239732219653179, swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_TopLeft, swBomType_e.swBomType_Indented, "Default", "C:\Users\Utente\Desktop\bom-standard.sldbomtbt")

          swBOMTable.Text(0, 0) = "My BOM Table"

          End Sub