You can try editing my macro to suit your needs. This saves every table in a document in its own file on your desktop. The vbTab value is the separator so if you want a csv then you can change it to "," instead. I hope that this helps.
Sub main() Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swAnno As SldWorks.Annotation Dim swTable As SldWorks.TableAnnotation Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc Debug.Print "File = " & swModel.GetPathName Set swAnno = swModel.GetFirstAnnotation Do While Not swAnno Is Nothing If swAnno.GetType = swAnnotationType_e.swTableAnnotation Then Set swTable = swAnno.GetSpecificAnnotation Debug.Print " " & swAnno.GetName swTable.SaveAsText Environ("USERPROFILE") & "\Desktop\" & swModel.GetTitle() & "_" & swAnno.GetName & ".txt", vbTab End If Set swAnno = swAnno.GetNext Loop End Sub
Alex, I am an ERP software developer and SolidWorks Research Partner, looking to develop an interface to export the BOM fro a SolidWorks SLDASM file through VBA, manipulate each assembly / component found into my text Import format, and your script above was simply plug and play. It output the indented BOM perfectly, but in what appears to be a pre-defined format, without the ability to stop at each discovered row, format the row and output to text.
Being new to SW, I was wondering what it would take to take what you have here (Thanks, much, BTW), and add the ability to parse each row in the BOM, find certain data fields, and output to text one row at a time.
The SolidWorks API documentation is pretty good. I think this example can be helpful.
Delete unnecessary things and extend the code according to your requirements.