I've surfed the forum for solutions. Only one potentially fits my need if only I could get it to work. Note that the BOM does get created but does not get saved out. There are no errors, just no file.
<p><span style="font-family: 'courier new', courier;">Option Explicit</span></p><p><span style="font-family: 'courier new', courier;">'Preconditions: Assembly file is active and includes components</span></p><p><span style="font-family: 'courier new', courier;">'Postconditions: A file is saved which contains BOM info</span></p><p></p><p><span style="font-family: 'courier new', courier;">Dim swApp As SldWorks.SldWorks</span></p><p><span style="font-family: 'courier new', courier;">Dim swModel As SldWorks.ModelDoc2</span></p><p><span style="font-family: 'courier new', courier;">Dim swBOMTable As SldWorks.BomTableAnnotation</span></p><p><span style="font-family: 'courier new', courier;">Dim swTable As SldWorks.TableAnnotation</span></p><p><span style="font-family: 'courier new', courier;">Dim swAnn As SldWorks.Annotation</span></p><p><span style="font-family: 'courier new', courier;">Dim strBOMTemplate As String</span></p><p><span style="font-family: 'courier new', courier;">Dim strOutputPath As String</span></p><p></p><p><span style="font-family: 'courier new', courier;">Sub main()</span></p><p></p><p><span style="font-family: 'courier new', courier;">strBOMTemplate = "D:\\Users\\204065774\\Documents\\SolidWorks\\Mike's templates\\standard BOM.sldbomtbt"</span></p><p></p><p><span style="font-family: 'courier new', courier;">Set swApp = Application.SldWorks</span></p><p><span style="font-family: 'courier new', courier;">Set swModel = swApp.ActiveDoc</span></p><p><span style="font-family: 'courier new', courier;">Set swBOMTable = swModel.Extension.InsertBomTable(strBOMTemplate, 0, 0, 3, "default") 'BOM is created in the assembly</span></p><p></p><p><span style="font-family: 'courier new', courier;">Set swTable = swBOMTable</span></p><p></p><p><span style="font-family: 'courier new', courier;">strOutputPath = "c:\\" & "BOMTable_" & Left(swModel.GetTitle(), Len(swModel.GetTitle) - 7) & ".xls"</span></p><p><span style="font-family: 'courier new', courier;">Debug.Print strOutputPath</span></p><p></p><p><span style="font-family: 'courier new', courier;">swTable.SaveAsText strOutputPath, vbTab 'Nothing happens here. No errors, no file, nothing.</span></p><p></p><p><span style="font-family: 'courier new', courier;">End Sub</span></p>SolidworksApi macros
