I have code that is meant to detect whether the user has enabled access to the VBA Project Object Model. (If the function returns false, I display a MsgBox to inform the user how to enable this.)
The function mainly works well. However there are scenarios where this function will return false even when the user has access enabled.
When I have this code inside an Add-In and the user opens a XLSM, Excel displays the Macros Disabled prompt. Before the user can enable, the Add-In fires the warning that they need to enable access to the Object Model!
Question 1 - How do I modify the function so that it will detect if the active workbook has macros disabled or the issue is due to the POM access not enabled?
(Note I'm usually running this in AddIns so using the hide/show sheets trick is not going to work as I didn't create the XLSM that the user opens)
I have also had this function return a false positive when the end user has their macros settings to only allow macros with signatures.
Question 2 (Bonus/Optional Question) - Is there any way the Add-In can detect if the user has this signature requirement set? (Would reading their registry keys be a reliable method?)
Function provided below (Although I'm now thinking it might be cleaner to create separate functions for the above questions and run them before checking this one)
Bookmarks