1 Reply Latest reply on Sep 12, 2014 9:58 AM by Jesse Seger

    Using VBA to output BOM table

    Jeremy Knibb


      I am new to SolidWorks but working with a designer who knows the product well. I'm working on a way to export data from SW into an ERP system.


      I need to export the custom properties for each part in an assembly to a csv we but need to be able to manipulate the data as its being written to the csv file.

      For example one of the properties is Class with values such as "SH - Steel Section" and I need to just take the first 2 characters "SH"

      I also need to add in additional text strings that the ERP system needs.


      I've seen the macros that export a BOM table to csv or .xls but I need to process the parts in the BOM one part at a time not ss a single table


      In summary I want to:

      • interrogate each line at a time
      • determine what kind of part it is
      • apply some data manipulation to the various properties, add in string data etc
      • then write that line to the csv


      Any help much appreciated



        • Re: Using VBA to output BOM table
          Jesse Seger

          Check out the attached macro.


          It locates a bom feature.

          Then it loops through each row and gets the components that make up that row.

          I included some comments to try and get you on the correct path.


          Edit... I've included a screen shot of the bom settings.  You can parse the ItemNumber to know which level you are at in the bom in case you want a separate csv file for each bom.