AnsweredAssumed Answered

Inserting a View Into an Open Drawing with CreateDrawViewFromModelView3 Method

Question asked by Kim White on Feb 10, 2020
Latest reply on Feb 10, 2020 by Kim White

I'm trying to using the following code to insert a drawing view into an open drawing. It inserts the view but throws out an error: "Run-time error '438': Object doesn't support this property or method"


'----------------------------------------------------------

'Precondition: Drawing open with several views of model already inserted

'----------------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim Part As DrawingDoc
Dim swView As SldWorks.View
Dim ModelPath As String

'----------------------------------------------------------

Sub main()

   Set swApp = Application.SldWorks
   Set swModel = swApp.ActiveDoc
   Set Part = swModel
   Set swView = Part.GetFirstView().GetNextView

 

   ModelPath = swView.GetReferencedModelName
   Debug.Print ModelPath
   swView = Part.CreateDrawViewFromModelView3(ModelPath, "*Front", 0.28, 0.02, 0)    'Error appears here
   
End Sub

'----------------------------------------------------------

 

Any ideas where I'm going wrong?

Outcomes