13 Replies Latest reply on Nov 5, 2015 12:34 PM by Deepak Gupta Branched from an earlier discussion.

    Re: Removing and then adding tables in a drawing

    Deepak Gupta

      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)