13 Replies Latest reply on Nov 10, 2017 1:48 AM by Deepak Gupta

    Macro to export a BOM with thumbnails to excel

    Eduardo Ortíz

      Hello everyone!

       

      I'm looking for a macro to export a bom with thumbnails to excel, I have tried this from another post:

       

      ---------------------------------------------------

      Dim swApp As SldWorks.SldWorks
      Dim swModel As SldWorks.ModelDoc2
      Dim swBOMTable As SldWorks.BomTableAnnotation
      Dim swTable As SldWorks.TableAnnotation
      Dim swAnn As SldWorks.Annotation

      Const BOMTemplate As String = ""
      Const OutputPath As String = "C:\"

       

      Sub main()

          Set swApp = Application.SldWorks
         
          Set swModel = swApp.ActiveDoc
         
          Set swBOMTable = swModel.Extension.InsertBomTable(BOMTemplate, 0, 0, swBomType_e.swBomType_Indented, "")
         
          Set swTable = swBOMTable

       

          swTable.SaveAsText OutputPath & "BOMTable_" & swModel.GetTitle() & ".xls", vbTab

       

          Set swAnn = swTable.GetAnnotation
         
          swAnn.Select3 False, Nothing
         
          swModel.EditDelete
         
      End Sub

      ---------------------------------------------------

       

      It works but i still need the Thumbnails, I hope you can help me,

       

      Thank you all.