Help with macro

Hi I have tried to run the following macro but it alwayspromt the dimension quantities and i have to make an enter o esc tokeep running the macro.

I tried to putPart.ClearSelection2 True and Part.SetPickMode after thelines which creates the dimension but it doesn't work.

Thank you in advance

SolidworksApi macros