Run-Time error '438': Object doesn’t support this property or method VBA

hi guys im posting the coding please identify and explain the mistakes

Sub CATMain()
Set objpart = CATIA.ActiveDocument.Part
Set objsketch = objpart.slot_1.Item(1).sketch_2.Item(1)
End Sub

Answer
 
Comments 1

1 Answer

I'll have to go back and look at my old VBA and VBS files but I remember that sometimes I had to write the code in a VBS macro script and call it from a VBA project file .... I know it sounds crazy but some functions work in VBS and not directly in VBA.
The fact that the error said "Object doesn’t support this property or method" makes me think that this is the problem. Try writing the function in a VBS macro script (which you can also write and edit in any text editor) and call it from your VBA project file.

 
Comments 1