I once knew a guy who used to give his house guests pieces of cheese as they walked through his front door. Not for them, for his dog.

It was his magic formula: Feed the dog cheese and he’s your friend for life.

Back when I had my first dog, Toby, I’d grab a tennis ball and go outside whenever I expected company. The guest would toss him the ball and Toby would catch it and then we’d go into the house. That was all it took. Friends for life.

I am still looking for the magic formula for Angus.

All summer, friends endured Angus barking at them for several minutes whenever they visited. No matter where we introduced them — in the front yard, out on the sidewalk, across the street, down the block — Angus barked his head off for a good five minutes.

We’d make him sit, he’d leap up and bark, we’d make him sit again, he’d jump and bark, and all the while our guests were handing over Charlee Bear treats as fast as they could. Angus would swallow them down and bark.

Eventually, we would troop into the house, and Angus would plop down on the rug. He’d be a model dog for the rest of the visit. Friend for life.

Still, I was pretty sure that barking at our friends for the first five minutes of every visit was not the magic formula I was looking for.

And then came the day of Angus’ leap, and I knew I had to figure things out.

On that August day, I lost control of Angus’ leash and he jumped on a friend, paws on her shoulders, almost knocking her over, and then he turned to her husband and jumped right at him and barked in his face.

I was horrified. Nobody was hurt, but still. We put Angus in his crate and he stayed there for the rest of the visit.

The trainer came a few weeks later. She told us that we should make Angus sit about 10 feet away from the front door, but within sight of the door. When she walked in, we were to start shoveling treats into his mouth.

We did this. Angus barked.

When he calmed down — this took a couple of minutes — we switched to giving him treats whenever he looked at the trainer and didn’t bark.

Slowly, we decreased the distance between Angus and her. Finally, he sat quietly at her feet and she gave him a treat. And after that, he was great — she stayed for another hour or so, and he never barked again.

She told us that she thought Angus’ barking was excitement, not aggression, and that over time, if we practice this, he will calm down.

So is this the magic formula? Maybe. But it’s pretty time-consuming and having Angus bark at guests indoors is only marginally better than having Angus bark at guests outdoors.

We will keep working on this, because Angus needs to learn both manners and impulse control. But in the meantime, we might have found a workaround.

A few days before the training session, our friend Sporty came to town. This time, we put both of our dogs in the backyard. “Angus will bark at you,” I warned Sporty as he walked into the house, but he — the owner of a gorgeous, huge Doberman himself — was not worried.

We went out onto the back porch. Angus was busy in the yard, snuffling around for chipmunks, maybe, or digging an unauthorized hole. He glanced at us, but he didn’t bark. After a while, he trotted up the porch steps. He didn’t bark. He circled Sporty’s chair. He didn’t bark. And then he walked up to Sporty and smooched him on the nose.

The door training will continue for as long as it takes. But it’s nice to have a magic formula in my back pocket.

Laurie Hertzel is a dog lover, not a dog expert. She is chronicling the first year of her puppy’s life on these pages.

Coming Oct. 27: Angus needs a hobby. Read all the Puppy Chronicles at startribune.com/puppy.