Hi Tswar,
Based on my research, I didn't find any VBA code can achieve it. Any community members who have related experience are welcome to share your insights here.
If you want to check the accounts signed into Excel, you may go to File>Account>Switch account> Check the Current Account and Other Account section.
Regards,
Felix