I am looking to have a parsing program stop when it hits the end of the doc.

As it is right now ist just starts from the beginning again.
something like


if Selection = <end of doc> code then

get out here

end if