select and change multiple tolerances in drawing using api

I recorded a macro and then used the code.

I can change one dimension only. It comes up with error when there are more than 1 dimension is selected

SolidworksApi macros