Programmatically saving BOM to Excel

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.

Option Explicit

'Preconditions: Assembly file is active and includes components

'Postconditions: A file is saved which contains BOM info

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

Dim strBOMTemplate  As String

Dim strOutputPath   As String

Sub main()

strBOMTemplate = "D:\Users\204065774\Documents\SolidWorks\Mike's templates\standard BOM.sldbomtbt"

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set swBOMTable = swModel.Extension.InsertBomTable(strBOMTemplate, 0, 0, 3, "default") 'BOM is created in the assembly

Set swTable = swBOMTable

strOutputPath = "c:\" & "BOMTable_" & Left(swModel.GetTitle(), Len(swModel.GetTitle) - 7) & ".xls"

Debug.Print strOutputPath

swTable.SaveAsText strOutputPath, vbTab 'Nothing happens here. No errors, no file, nothing.

End Sub

SolidworksApi macros