Brenda Vaccaro will replace Valerie Harper in “Nice Work If You Can Get It” at the Ogunquit Playhouse, the theater announced Saturday.

Harper, best known for her role as Rhoda Morgenstern in “The Mary Tyler Moore Show” in the 1970s, was hospitalized Wednesday when she collapsed shortly before that evening’s performance. She has been diagnosed with lung cancer and brain cancer in recent years, but statements from her family have not said what caused her collapse.

“Valerie is feeling great right now and we want her to continue to rest and to enjoy her family,” Bradford Kenney, executive artistic director of the Ogunquit Playhouse, said in a statement issued Saturday afternoon. “After discussing with them, we decided that we wanted to relieve her of any pressure of having to return to the show, which only runs for two more weeks.”

The statement said the choice of Vaccaro as Harper’s replacement was done “with Valerie’s blessing.”

An understudy has filled in for Harper in the role of bootlegger Millicent Winter since Wednesday. Vacarro will take over that role Tuesday through the end of the run Aug. 15.

The musical comedy stars Sally Struthers as a prohibition enforcer and includes several George and Ira Gershwin songs, including “But Not for Me,” “Let’s Call the Whole Thing Off” and “Someone to Watch Over Me.”

Harper, 75, has won four Emmy Awards and starred in nearly two dozen television movies. She was twice nominated for Golden Globe Awards and was also nominated for a Tony Award for best actress for her performance in “Looped.”

Vaccaro has performed on Broadway since the early 1960s. She’s been nominated three times for Tony Awards and was nominated for Academy Awards for her performances in “Midnight Cowboy” in 1969 and “Once Is Not Enough” in 1975. She won an Emmy in 1974 for “The Shape of Things,” a television movie.