Based on my knowledge, your requirement needs the help of tools.
Such as for Microsoft 365 apps, there is a tool "Readiness Toolkit tool" for Office add-ins and VBA.
According to the article "Use the Readiness Toolkit to assess application compatibility for Microsoft 365 Apps", this tool could crearte a VBA readiness report, including an inventory of recently opened files that use VBA macros.
For more about this tool, you could also refer to following article.
Using Office Readiness/Telemetry Tools To Plan Macro/Add-On Hardening
(Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.)
Hope this information could be helpful.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.