Javier,
You should really be running the example code from the VBA editor in SolidWorks. However, to run the code from VB, you must not paste the code into a form. You must remove the form and insert a module. Paste the code into the module, set your references and then change the line of code that reads:
Set swApp = Application.SldWorks
to
Set swApp = CreateObject("SldWorks.Application")
Now run the code. It should work. I just used your example code and followed the steps I described and it ran perfectly.
Having struggled with all this API stuff when I first began, I should have looked more closely at the example code. For that I say, I am sorry. I would have set you on a better course if I would have taken the time the first time.
Regards,
Regg