Need some help with BOM table formatting

disclaimer: I'm pretty weak in VB skills so please be explicit with your help.  I'm using the SolidWorks VB editor.

All,

I copied the add BOM example from the help file and tweaked it for my template location and that I want to use the my table anchor but what I cannot figure out is why when the table is placed on the page it comes in without the formatting that I think is saved with the template.  Do I need to explicity indicate how I want each column, column header, and row to be formatted or is there some option that tells the macro to use the saved formatting?

This is what I have:

Option Explicit

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swSelMgr As SldWorks.SelectionMgr

Dim swFeatMgr As SldWorks.FeatureManager

Dim swView As SldWorks.View

Dim swBomAnn As BomTableAnnotation

Dim swBomFeat As SldWorks.BomFeature

Dim AnchorType As Long

Dim BomType As Long

Dim Configuration As String

Dim TableTemplate As String

Dim Names As Variant

Dim Visible As Variant

Dim boolstatus As Boolean

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swSelMgr = swModel.SelectionManager

Set swFeatMgr = swModel.FeatureManager

' Select view

Set swView = swSelMgr.GetSelectedObject6(1, 0)

AnchorType = SwConst.swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_TopRight

BomType = SwConst.swBomType_e.swBomType_TopLevelOnly

Configuration = ""

TableTemplate = "C:\solidworks data\SW_BOMTables\Bom Table - Speedline.sldbomtbt"

' Insert BOM table

Set swBomAnn = swView.InsertBomTable3(True, 0, 0, AnchorType, BomType, Configuration, TableTemplate, False)

swModel.ClearSelection2 True

' Because BOM type is swBomType_TopLevelOnly, then work with BomFeature to get and set configurations

Set swBomFeat = swBomAnn.BomFeature

Names = swBomFeat.GetConfigurations(False, Visible)

Visible(0) = True

boolstatus = swBomFeat.SetConfigurations(True, Visible, Names)

'Update FeatureManager design tree

swFeatMgr.UpdateFeatureTree

End Sub

Here is what I want the table to look like:

Here is what it looks like using the macro:

It seems like I might have to use some commands from the help page for ITableAnnotation but I'm not sure how to use them.

Any help is greatly appreciated.

Jody

SolidworksApi macros