AnsweredAssumed Answered

Export multiple hole tables to .CSV using vba macro

Question asked by Steven Henriksen on Mar 25, 2020
Latest reply on Mar 27, 2020 by Steven Henriksen

Hi 

I need to extract data in multiple hole tables from a drawing to .CSV 

 

Using the Export to CSV macro here Export SOLIDWORKS table to CSV using VBA macro im able to export a holetable if i manually select it, and by adding a bit of code i've bin able to make it select the top most table and export it, but i can't seem to get it to select any of the other tables (usually 4 in a drawing)

 

I either need something that will either find all hole tables in the drawing and export it or that can select a specific table using the name of the table.

 

I've managed to select the other tables by using a .SelectByID2 command but this would use the feature ID and that is gonna change from drawing to drawing, 

 

Inserting this code at the top of the Export to CSV macro it will select the first table and export it
changing "Hole Table3" to feature ID no. would select the specific feature

 

Obviously this code is flawed, but i dont know what to use instead of .SelectByID2

<p>     Set Part = swApp.ActiveDoc
    Dim myModelView As Object
    Set myModelView = Part.ActiveView
    myModelView.FrameState = swWindowState_e.swWindowMaximized
    boolstatus = Part.Extension.SelectByID2("Hole Table3", "HOLECHART", 0.456487273042117, 0.499525611915363, 0, False, 0, Nothing, 0)

</p>

 

Best regards & thanks in advance

Steven Sperling Henriksen

Outcomes