1 Reply Latest reply on Apr 14, 2018 4:10 AM by Kuhn Dimitrie

    Set bill of material to automatic column width

    Andreas Beck

      Hello,
      I am currently working on a macro which updates an bill of material in a drawing according to the config used and sorts the lines.
      Now I'm still looking for the appropriate command, which gives me the columns on the automatic max. Column width sets, but I can not find a matching snippet.
      So according to the double-click on the dividing line of two columns.
      Currently I can set a fixed (40 mm) column width with this code:

       

      Dim swBomFeat As SldWorks.BomFeature

      Dim vTables As Variant

      Dim swBomTable As SldWorks.BomTableAnnotation

      Dim boolstatus As Boolean

       

      swBomFeat.SetConfigurations False, vConfVis, vConfNames
      vTables = swBomFeat.GetTableAnnotations
      Set swBomTable = vTables(0)

      boolstatus = swBomTable.SetColumnWidth(-2, 0.04, 0)

       

       

      For Excel I know the corresponding function.

       

      xlWs.UsedRange.EntireColumn.AutoFit

       

      Does anyone have an idea, if this works at all by macro?

       

      Greetings, Andi