Ex-News of the World editor Andy Coulson tried to dupe Steve Coogan into revealing private details about his life, the Leveson Inquiry has heard.
Coogan was tipped off by Rav Singh, one of the paper's journalists and a "friend of a friend", about the attempted sting.
From his office, Coulson got a woman to call Coogan and try to elicit information.
As a result of Singh's tip-off, Coogan did not divulge any information and no story resulted. To protect Singh, he also did not reveal that he knew it was a sting attempt.
The comic actor, best known for his character Alan Partridge, was giving evidence to the Leveson Inquiry into press culture and ethics on 22 November.
Some time later, Coogan received another call from Singh, who said they were going to write a story about the actor having an affair.
In exchange for confirmation of some of the facts, Singh agreed not to publish some of the other more "lurid" details involved.
Shortly afterwards, Coogan received a call saying that the phone conversation had been recorded and that the News of the World would be publishing all of the details, despite the agreement.
At one time, Coogan's pregnant girlfriend was doorstepped several times, across the space of a month, by a tabloid journalist.
His child's great-grandmother then had calls from a journalist posing as someone else, trying to get information.
The inquiry also heard evidence about a Daily Mail story involving Hollywood actor Owen Wilson and Coogan, who are friends.
A headline ran that accused Coogan of "leading Wilson to the brink of suicide". Coogan said that none of what was reported was true, which included regularly taking drugs with Wilson.
He said that he had never taken drugs with, or in front of, Wilson and that for nine months they "weren't even on the same continent".
Coogan also pointed out that the article itself had questioned the source of the story, fearing it may have been "revenge" for something.
"If they doubted the story's veracity, then why did they publish it?" he asked.
Robert Jay QC, who was leading the questioning, cited different articles where Coogan had spoken about his private life.
Coogan replied that much of what he had spoken about was already in the public domain and that other information, which had been spoken about off the record, had been published anyway.
He also said that he did not want to appear to be "a curmudgeon" by not answering any questions he was asked during interviews.
He now believes that it is the "lesser of two evils" to refuse to comment, instead of trying to correct misinformation.
"My closet is now empty of skeletons," he said, given the amount of coverage his private life has had in the press.
Coogan said he was not necessarily "waving a flag for privacy" and is not giving evidence "with any great enthusiasm". He is just concerned and other "celebrities, for want of a better term", are too, though they "don't have the stomach" to speak out.
"This is not, in case the press try to portray it that way, the Steve and Hugh Show.
"I like to keep myself private... I've never set myself up as a paragon of virtue or a model of morality."
On apologies in the press, he said: "You can't give back the pound of flesh you've taken."
They should, nevertheless, feature more prominently, he added.
"Whatever [regulation] is in place needs to wield more power and people need to be able to use it whether nor not they have money.
"What's very important to me is press freedom. It's often used as a smokescreen to legitimise invasions of privacy, [but] there's some very good journalism in this country."