A search for the very rare B∗0→μ+μ− and Bs∗0→μ+μ− decays is conducted by analysing the Bc+→π+μ+μ− process. The analysis uses proton-proton collision data collected with the LHCb detector between 2011 and 2018, corresponding to an integrated luminosity of 9fb−1. The signal signatures correspond to simultaneous peaks in the μ+μ− and π+μ+μ− invariant masses. No evidence for an excess of events over background is observed for either signal decay mode. Upper limits at the 90% confidence level are set on the branching fractions relative to that for Bc+→J/ψπ+ decays, \begin{equation*}
{\cal R}_{B^{*0}(\mu^+\mu^-)\pi^+/J\mskip -3mu/\mskip -2mu\psi\pi^+} < 3.8\times 10^{-5}\ \text{ and }\:
{\cal R}_{B_{s}^{*0}(\mu^+\mu^-)\pi^+/J\mskip -3mu/\mskip -2mu\psi\pi^+} < 5.0\times 10^{-5}\,. \end{equation*}