VBA Macro to run studies and generate reports? (SolidWorks Simulation API)

Hello all,

I am trying to write a macro that meshes and runs all the existing studies in the model and generates reports.

Can somebody please help me how to get the Simulation API to work?

Even trying to run the following generates an error: (Compile error: User-defined type not defined; for CosmosWorksLib objects)

http://help.solidworks.com/2013/English/api/swsimulationapi/Create_Fatigue_Study_Example_VB.htm

I will appreciate any help.

SW Version: Premium 2013 x64 Edition

Kind Regards,

SolidworksSimulation