A friend used to do that with wasps and an air pistol, but I usually waited until they landed. When that got "too easy" we backed up a couple more steps and started over.
Carpenter bees are very good pollinators for your fruit and vegetables. If they have suitable housing they won't attack your structures so much. just saying.
from about the age of 6 or 7 carried one while in the marines ever where I went was a joke if we ran out of ammo I hade my slingshot and rocks.
that's the problem they make there home in my home and sheds they eat threw presser treated boards so they become targets.
Carpenter Bees | Entomology Perhaps you could entice them to move, to a better site near your flowers or garden. Some woods are more to thier liking and bare wood is a target, so paint helps. Maybe add a raw wood post post or flower box near the garden edge for them.
thought that's what I was doing lol. no my sheds over run with them but the last three years I been fixing the problem they were so bad in my grape vine abor that they broke hade to rebuild them.