Police have charged a man with possessing a pickaxe close to where the Queen was due to begin a walkabout in Huddersfield.
Uniformed police and royal protection officers swooped on a suspect about 30 minutes before the Royal party arrived in the town on Thursday.
A 34-year-old man is due to appear before the town's magistrates charged with possession of an offensive weapon.
The incident happened during a Royal visit to West Yorkshire.
Earlier, in Bradford, the Queen was presented with a posy by the five-year-old daughter of murdered policewoman Sharon Beshenivsky.
Lydia Beshenivsky met the Queen in the city's Centenary Square.
Pc Beshenivsky was shot dead on Lydia's fourth birthday, during a robbery at a Bradford travel agents in 2005.