cosmosworks object not defined

I have met the following error when I ran macro with 2017 version. Does anyone have an idea what I need to do to fix it? Thx.

SolidworksApi/macros
Answers 1
AJ
AJ 2021-04-09 Best Answer

Self explanatory. Type is not defined because you don't have a reference to the solidworks simulation interop dll. The file is called SolidWorks.Interop.cosworks.dll. You will find in your SOLIDWORKS installation directory (Something like C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS 2018\SOLIDWORKS\api\redist)

Cheers,
Amen
SOLIDWORKS API and PDM API Training and Services ​