Dogs bark as a way to communicate, and you shouldn't expect your puppy to give up the practice entirely. Your dog might bark to be let out or in, to get you to play with him, to get the attention of another dog or to warn you of a stranger approaching the house. Your goal in training your puppy should not be to completely stop him from barking but to make him stop barking when you command. If you want a quiet animal, get a bunny.
Begin Training
Hang out with your puppy and wait for him to bark. Let him get out a few barks, and praise him and pet him for saying "Hi" or telling you a stranger is coming. Then say, "Stop barking," and hold up a treat for him. He will stop barking and sniff at the treat. Praise him and pet him for a few seconds, then give him the treat. The next time he barks, repeat the command and make him wait about 5 seconds for the treat. Make your dog wait a little longer every time.
Correct Your Dog
If he does bark in the middle of the wait, reprimand him the instant he makes a sound. At first, say, "Bad dog," in a cold tone. Then make him wait a bit longer in silence before getting the treat. Once your dog has figured the whole thing out and can make it for a minute or two without barking, you can reprimand him more harshly when he messes up. If you say, "No barking," and he keeps barking, then shouting, "No barking!" at him should work.
Keep Your Dog Happy
Lonely, neurotic dogs who are locked inside all day and never get to play are the worst barkers. If you want your dog to stay quiet when you are at work, you must take good care of him. Take him to a local dog park at least a couple times a week to let him play and make friends. Exercise him every day, and give him toys to play with. If your dog has the chance to burn off some nervous energy, he won't pace back and forth, barking at anything that moves all day.