(CNN) —
Republican presidential contender Sen. Ted Cruz apologized for an ill-timed joke about Vice President Joe Biden Wednesday night.
While speaking at a GOP dinner in Michigan on Wednesday, Cruz delivered an oft-told stump speech line poking fun at Biden, mentioning his name and then saying, “You know the nice thing? You don’t need a punchline,” according to the Detroit News.
“Honestly, it works,” Cruz said, according to the news report. “The next party you’re at, just walk up to someone and say, ‘Vice President Joe Biden’ and just close your mouth. They will crack up laughing.”
While the line is often well-received on his campaign trail, this time it fell flat. Biden’s son, Beau, passed away from brain cancer on Saturday.
RELATED: Ted Cruz ‘imagines’$2 2016 presidency in Liberty speech
Cruz took to Facebook and Twitter to issue an apology.
“It was a mistake to use an old joke about Joe Biden during his time of grief, and I sincerely apologize. The loss of his son is heartbreaking and tragic, and our prayers are very much with the Vice President and his family,” Cruz wrote.
Beau Biden’s funeral will be held on Saturday in Dover, Delaware, where he served as the state attorney general. President Barack Obama is scheduled to deliver his eulogy.
Photos: Moments from Ted Cruz's career
PHOTO:
Joe Raedle/Getty Images
U.S. Sen. Ted Cruz, a Republican presidential candidate, speaks during a campaign rally at the Indiana State Fairgrounds on Monday, May 2.
Photos: Moments from Ted Cruz's career
PHOTO:
Ty Wright/Getty Images
Cruz holds up the hand of Carly Fiorina at a campaign rally in Indianapolis on Wednesday, April 27. Cruz named Fiorina, a former presidential candidate, as his running mate.
Photos: Moments from Ted Cruz's career
PHOTO:
Scott Olson/Getty Images
Cruz celebrates his Wisconsin primary win with his wife, Heidi, and Gov. Scott Walker in Milwaukee on Tuesday, April 5. Walker endorsed Cruz for the presidency.
Photos: Moments from Ted Cruz's career
PHOTO:
Scott Olson/Getty Images
With his wife by his side, Cruz tours the Dane Manufacturing facility before speaking to workers in Dane, Wisconsin, on Thursday, March 24.
Photos: Moments from Ted Cruz's career
PHOTO:
RHONA WISE/AFP/Getty Images
Cruz speaks during the CNN Republican debate in Miami on Thursday, March 10.
Photos: Moments from Ted Cruz's career
PHOTO:
Getty Images
Cruz and his wife wave to the crowd at Liberty University after he announced his presidential candidacy in Lynchburg, Virginia, on March 23, 2015.
Photos: Moments from Ted Cruz's career
PHOTO:
Justin Sullivan/Getty Images
Cruz speaks during the 2013 NRA Annual Meeting and Exhibits at the George R. Brown Convention Center on May 3, 2013, in Houston, Texas.
Photos: Moments from Ted Cruz's career
PHOTO:
tedcruz.org
Cruz poses with his wife, Heidi, and his daughters Caroline and Catherine.
Photos: Moments from Ted Cruz's career
PHOTO:
Scott Olson/Getty Images
Cruz (left) fields questions from Bruce Rastetter at the Iowa Ag Summit on March 7, 2015, in Des Moines, Iowa. The event allows the invited speakers, many of whom are potential 2016 Republican presidential hopefuls, to outline their views on agricultural issue.
Photos: Moments from Ted Cruz's career
PHOTO:
Win McNamee/Getty Images
Nobel Peace Laureate Elie Wiesel (left) listens as Cruz (right) speaks during a roundtable discussion on Capitol Hill March 2, 2015 in Washington, D.C. Wiesel, Cruz and Rabbi Scmuley Boteach (center) participated in a discussion entitled 'The Meaning of Never Again: Guarding Against a Nuclear Iran.'
Photos: Moments from Ted Cruz's career
PHOTO:
Erich Schlegel/Getty Images
Governor Greg Abbott (center) speaks alongside Cruz (left), Attorney General Ken Paxton (right) at a joint press conference February 18, 2015, in Austin, Texas.
Photos: Moments from Ted Cruz's career
PHOTO:
Mark Wilson/Getty Images
Sen. Patrick Leahy (right) escorts Loretta Lynch back from a lunch break as Cruz (left) sits nearby during her confirmation hearing before the Senate Judiciary Committee January 28, 2015, on Capitol Hill.
Photos: Moments from Ted Cruz's career
PHOTO:
Richard Ellis/Getty Images
Cruz greets supporters at the South Carolina Tea Party Coalition convention on January 18, 2015, in Myrtle Beach, South Carolina. A variety of conservative presidential hopefuls spoke at the gathering on the second day of a three-day event.
Photos: Moments from Ted Cruz's career
PHOTO:
Joe Raedle/Getty Images
Cruz (left) and then-Texas Governor Rick Perry stand together during a press conference at the front gate of Fort Hood about Iraq war veteran, Ivan Lopez, who killed three and wounded 16 before taking his own life on April 4, 2014, in Fort Hood, Texas.
Photos: Moments from Ted Cruz's career
PHOTO:
Win McNamee/Getty Images
(Left to right) Sen. Lindsey Graham, Sen. John McCain and Cruz listen as President Barack Obama delivers the State of the Union address on January 28, 2014, in Washington, D.C.
Photos: Moments from Ted Cruz's career
PHOTO:
Mark Wilson/Getty Images
Then-Senate Minority Leader Mitch McConnell (second right), poses with Republican senators-elect Jeff Flake (left), Deb Fischer (second left), and Cruz (right) at the U.S. Capitol on November 13, 2012, in Washington, D.C.
Photos: Moments from Ted Cruz's career
PHOTO:
Jim Watson/AFP/Getty Images
Cruz speaks to reporters on September 25, 2013, after ending his talk-a-thon on the floor of the US Senate in Washington, D.C.
Photos: Moments from Ted Cruz's career
PHOTO:
Alex Wong/Getty Images
Cruz speaks as then-Rep. Michele Bachmann (left), Sen. Mike Lee (second right) and Sen. Rand Paul (right) listen during a news conference May 16, 2013, on Capitol Hill.
Photos: Moments from Ted Cruz's career
PHOTO:
Mark Wilson/Getty Images
Cruz listens to testimony during a Senate Judiciary Committee hearing on April 22, 2013, in Washington, D.C.
Photos: Moments from Ted Cruz's career
PHOTO:
Chip Somodevilla/Getty Images
Cruz holds a news conference to announce the plan to defund Obamacare on March 13, 2013.
Photos: Moments from Ted Cruz's career
PHOTO:
Mark Wilson/Getty Images
Cruz speaks at the CPAC on March 6, 2014, in National Harbor, Maryland.
Photos: Moments from Ted Cruz's career
PHOTO:
Tom Pennington/Getty Images
Then-Senate Republican Candidate and Texas Solicitor General Cruz speaks at the 'Patriots for Romney-Ryan Reception' on August 29, 2012, in Tampa, Florida.
Photos: Moments from Ted Cruz's career
PHOTO:
Win McNamee/Getty Images
Then-Senate Republican Candidate and Texas Solicitor General Cruz speaks during the Republican National Convention at the Tampa Bay Times Forum on August 28, 2012.
Photos: Moments from Ted Cruz's career
PHOTO:
Spencer Platt/Getty Images
Then-Senate Republican Candidate and Texas Solicitor General Cruz speaks during the Republican National Convention in 2012.