Need a little help with this coding.

I've been having a little trouble with the document reference info not copying over. see thread below.

https://forum.solidworks.com/message/371754#371754

I have created a macro to try and populate the data, but I'm struggling to get it to include all the information i need to be added, but it limits me to how many lines i can add.

Sorry about the macro it's very patchy but i'm looking for a quick fix to quickly popluate the reference locations.

Can someone help me out.

SolidworksApi macros