[citation needed] On 9 February 1844 he was appointed colonial secretary at Hong Kong,[4] and accompanied its second governor John Francis Davis on HMS Spiteful arriving there on 8 May of that year.
[2]: 97 His next change was to Sucre, with the appointment of consul-general in the republic of Bolivia on 23 July 1847,[5] and on 14 April 1848 he was accredited as chargé d'affaires.
[citation needed] His diplomatic tact was thoroughly appreciated by the home government, for he was appointed on 2 December 1858 envoy extraordinary and minister plenipotentiary to the Xianfeng Emperor of China,[8] and on 1 March following chief superintendent of British trade in that country.
He proceeded to Peking on 7 November 1860 but withdrew to Tientsin for the winter, while arrangements were made for putting a residence in order for his reception.
[citation needed] He died, unmarried, at Boston in the United States on 19 September 1867, when his remains were embalmed and, being conveyed to Scotland, were interred at Dunfermline Abbey on 8 October.