Scottish golfer Stephen Gallacher has discovered he has qualified for the Open, less than 24 hours after being told he would miss out.
Gallacher had thought he had failed to qualify after being pipped to the final spot in the European Tour rankings.
However, the withdrawal of John Daly through injury is enough to secure his spot at Muirfield.
"Gallacher is first reserve and will take his place in the championship," organisers said in a statement.
It will be Gallacher's sixth appearance at the Open, with his best finish a tied 23rd in 2010.
"I got some great news saying I was first reserve," Gallacher told BBC Radio Scotland. "Then, about two later, I was told I was in.
"I'm absolutely over the moon."
The European Tour offers five Open places to players in their top 20 who have not yet qualified.
Following the where Gallacher finished joint eighth, he was sixth in line for one of these places, falling about 900 euros behind Glasgow's Marc Warren in the Race to Dubai prize money rankings.
But the 38-year-old from West Lothian, who has risen to 75 in the world rankings, can now look forward to staying at home while competing at Muirfield next week.
"It's going to be a great experience," he added. "I've got a lot of family and friends there. I can't wait."
Warren will make his first Open appearance after a joint-second finish at the BMW PGA Championship in May propelled him far enough up the rankings to earn a place.
Fellow Scots Lloyd Saltman and George Murray came through qualifying, along with Scottish amateur champion Grant Forrest, taking the home contingent to 10 - the highest since 2005.
However, there is no place for Colin Montgomerie who finished well off the pace at local qualifying at Gullane.
The Open takes place at Muirfield from 18-21 July.