He was severely affected by mustard gas and was sent home to recuperate. After recuperation he relinquished his commission in the Royal Irish Regiment when awarded a cadetship at the Royal Military Academy, where he graduated in February 1917. Shortly afterward he was seconded to the Royal Flying Corps and trained as a pilot at the Central Flying School, and appointed a flying officer on June 28th. On August 15th he joined No. 40 Squadron RFC, where he benefited from mentoring by Edward Mannock. He originally flew a Nieuport 17, but with no success in battle. By the year's end McElroy was flying S.E.5s and claimed his first victory on December 28th.
He continued to steadily accrue victories by ones and twos. By the end of June he had ran his tally to 30.
In July, he added to his score almost daily, a third balloon busting on the 1st, followed by one of the most triumphant months in the history of fighter aviation, adding 17 victims during the month.
McElroy's continued apparent disregard for his own safety when flying and fighting could have only one end. On July 31st, after his 47th victory, he took to the sky for the last time. He failed to return from this flight and was posted as missing. Later it was learned that McElroy had been killed by ground fire. He was 25 years old.
McElroy's awards were;