In November 1698 and in January 1700 Harley was approached by the ministry to accept office in the government, on the latter occasion being offered the Secretaryship of State. He refused on both occasions as he did not want to serve with the Whigs. Upon the death of Anne's only surviving child, Prince William, Duke of Gloucester, in July 1700, King William III became concerned with the succession. William believed it was imperative that the crown should go to Sophia, Electress of Hanover, or her descendants, should Anne die without child. He wrote to Harley and summoned him to an audience, where he asked Harley what demands the Commons would make in order to be persuaded to pass a Bill incorporating the new line of succession. It was agreed that the Bill would include further limitations of the monarch's power. Afterwards, William approved his election as Speaker of the House of Commons.