Re: Removing and then adding tables in a drawing

You can get the model type from the view and then use the IF condition.

<p>Option Explicit</p><p>Sub main()</p><p>    Dim swApp                       As SldWorks.SldWorks</p><p>    Dim swModel                     As SldWorks.ModelDoc2</p><p>    Dim swView                      As SldWorks.View</p><p>    </p><p>    Set swApp = Application.SldWorks</p><p>    Set swModel = swApp.ActiveDoc</p><p>    Set swView = <span style="background-color: #f6f6f6;">swModel.SelectionManager</span>.GetSelectedObject5(1) ' Make sure a view is selected</p><p>    Debug.Print swView.ReferencedDocument.GetType ' 1 for part and 2 for assembly.</p><p>    </p><p>End Sub</p>

Also please move this thread to API section (use move discussion on right side)

SolidworksApi macros