
Timing is important with the method you describe, as is increasing duration. So initially, you would say 'quiet', produce the treat right in front of her nose, and hold it there for 4 or 5 seconds before praising and rewarding her. This way you've got a decent bit of non-barking that's getting the reward. This can still fall foul of her learning to bark then shut up to get the treat, though, so once she's got that bit down, you would start waiting a second longer each time so that she learns that it's going quiet and
staying quiet that gets the treat.
All of that said; you need to address the reason for the barking, which is often either overexcitement or nerves (more often the latter IME). The remedy is pretty similar either way - give her space so she's calmer (proximity increases stress increases reactivity, regardless of the reason for it), then reward calm behaviour. And don't just wait for it to happen, encourage it! Try keeping her attention with food and rewarding quickly if she sees a trigger but doesn't react (as in instantly reward). Talk to her, move her further away if need be, engage with her to help her stay calmer and give you more to reward.