0

I am brand new to Solidworks VBA. In Excel, I followed along the example of "Import STEP File Example (VBA)" and immediately received an error.

The dim swApp as sldworks.sldworks and set swApp = Application.Sldworks returned a Runtime error '438': Object doesn't support this property or method.

Screen shot of references used. SW version 2022:

references used

I tried opening a new Macro from within solidworks and the code showed Dim swApp as object.

Auto references using solidworks:

auto references

Can someone please shed light as to why the example code I found using sldworks.sldworks did not work? Am i missing a library reference or an update of some sort? Most of the example code I have found uses sldworks.sldworks. Not sure what is going on.

Vitalizzare
  • 4,496
  • 7
  • 13
  • 32
SML
  • 1
  • See this page where it indicates "Creating or Connecting to an Instance" https://www.codestack.net/solidworks-api/getting-started/stand-alone/connect-vbnet/ – bigcrazyal Aug 10 '23 at 16:19
  • To elaborate, only the solidworks macro editor knows how to handle "Application.Sldworks". Using Excel's VBA or VB.Net, you'll have to use either CreateObject() or GetObject(). – bigcrazyal Aug 10 '23 at 16:22
  • Thanks bigcrazy1. That's the help I was looking for. I appreciate it! – SML Aug 10 '23 at 18:03

0 Answers0