As soon as your dog starts barking, say “Enough” and then walk all the way over to him, moving the treat to within an inch of his nose and making clicking or smooching noises to get his attention. If the treat smells luscious, and it’s right beside his nose, he’ll turn away from what he was barking at and sniff the treat. But don’t give it to him yet. Palm it in your hand while saying “Good boy” a few times and use the treat to lure him away from what he’s barking at. Then give him the treat.