If traversed, continue to next

Hello all

I am writing a macro to make drawings with views and then save to main Assembly location. I have a 'for' loop where i am traversing to each part. The formation of program is:

For i= 0 to Number of parts

     if DWG file already exists Then

       If ask to overwrite = Yes Then

          Make Drawing

       End if

     Else

       IF check whether the loop already traversed to this part = NO Then

          Make drawing

       End if

     End If

Next

Is there a way to know : whether the loop has traversed/ iterated to the part already. and if not, then run the program. Please do suggest what can be a better formation of the program.

Thanks in Advance.

SolidworksApi/macros