Because of this , it passed the Act of Settlement 1701 . After Anne , the Crown would go to their nearest Protestant relative , Sophia , Electress of Hanover , and her Protestant heirs .
Princess Anne 's last surviving child , William , Duke of Gloucester , died in July 1700 , and , as it was clear that William III would have no more children , Parliament passed the Act of Settlement 1701 , which provided that after Anne the Crown would go to their nearest Protestant relative , Sophia , Electress of Hanover , and her Protestant heirs .