Sheet format replacement doesn't work with files from wpdm

I have a macro to  replace the sheet format and it's working ok unti I tried to run it on the drawing which is checked out from vault

if the drawing has 2 sheets, the macro only works on the second sheet

Is there anything I need to add in order it's workong on both sheets

Thx

SolidworksApi macros