One of our yorkies used to do that. Every time we took her out front to potty she would bark at everything it was very annoying. And even though my neighbors never complained I knew I had to correct that behavior.
One day I was at PetsMart and she was gong crazy barking at everything. One of the trainers came out to see what was happening because she was barking non stop really loud. She told me to teach her the "Leave it" command. Every time she does something you don't want her to do say just say "Leave it" She said this works better then saying "No" because some dogs get used to hearing "No" all the time.
Well I tried it right away with all my furbabies and sure enough it worked like a charm
When we go out to potty I get right in front of her and if she makes any barking sound I just say "Shush Leave It" and she stops instantly
You really have to be consistent though because it's not instant you have to keep doing it and some days are better then others but they do eventually get it.
Good Luck