Deepak Gupta

Re: Removing and then adding tables in a drawing

Discussion created by Deepak Gupta on Oct 30, 2015
Latest reply on Nov 5, 2015 by Deepak Gupta
Branched from an earlier discussion

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

Option Explicit

Sub main()

    Dim swApp                       As SldWorks.SldWorks

    Dim swModel                     As SldWorks.ModelDoc2

    Dim swView                      As SldWorks.View


    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swView = swModel.SelectionManager.GetSelectedObject5(1) ' Make sure a view is selected

    Debug.Print swView.ReferencedDocument.GetType ' 1 for part and 2 for assembly.


End Sub

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