Using API to make a macro to multiply embosses

Hi there!

I'm trying to create a macro to multiply embosses on a sheet metal. I just added a simple loop to the code but then i have  this error message, and it has apparently nothing to do with what i've written.

Does anyone knows what it is related to?

SolidworksApi macros