AnsweredAssumed Answered

Select General Table thru API

Question asked by Darrell Lindberg on Jul 5, 2018
Latest reply on Jul 5, 2018 by Artem Taturevych

As the title says I am trying to get data from a general table.


Recorded macro:


Sub main()


Dim myModelView As Object

Dim myTable As Object


Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

Set myModelView = Part.ActiveView

myModelView.FrameState = swWindowState_e.swWindowMaximized

boolstatus = Part.Extension.SelectByID2("DetailItem#@<sheet name>", "ANNOTATIONTABLES", 0, 0, 0, False, 0, Nothing, 0)

Set myTable = Part.SelectionManager.GetSelectedObject5(1)

myTable.Text(1, 0) = "test"

End Sub


The above code works. The trouble I am running into is determining the item#.


This will find the table in the feature tree but results in a error when attempting to use .Text()

boolstatus = Part.Extension.SelectByID2("WPS@<sheet name>", "GENERALTABLEFEAT", 0, 0, 0, False, 0, Nothing, 0)


What would be the best way to achieve this?