![]() |
How can I verify if "Trust access to visual basic project" is chec
I have a macro that requires this option to be checked.
"Trust access to visual basic project" I know the only way to check the box is either manually or through Send Keys. Is there a way through some property to see if it is checked or unchecked? If there is, I can shut the macro down prior to it crashing with a dialog box telling the user what to do to enable all the features. This would really help! Thanks, MikeZz |
How can I verify if "Trust access to visual basic project" is chec
Function VBAIsTrusted() As Boolean Dim mpVBC As Object Dim mpAlerts As Boolean mpAlerts = Application.DisplayAlerts Application.DisplayAlerts = False On Error Resume Next Set mpVBC = ThisWorkbook.VBProject.VBComponents.Item(1) On Error GoTo 0 Application.DisplayAlerts = mpAlerts VBAIsTrusted = Not mpVBC Is Nothing End Function -- __________________________________ HTH Bob "MikeZz" wrote in message ... I have a macro that requires this option to be checked. "Trust access to visual basic project" I know the only way to check the box is either manually or through Send Keys. Is there a way through some property to see if it is checked or unchecked? If there is, I can shut the macro down prior to it crashing with a dialog box telling the user what to do to enable all the features. This would really help! Thanks, MikeZz |
How can I verify if "Trust access to visual basic project" is
Perfect! This will be a great help Bob,
"Bob Phillips" wrote: Function VBAIsTrusted() As Boolean Dim mpVBC As Object Dim mpAlerts As Boolean mpAlerts = Application.DisplayAlerts Application.DisplayAlerts = False On Error Resume Next Set mpVBC = ThisWorkbook.VBProject.VBComponents.Item(1) On Error GoTo 0 Application.DisplayAlerts = mpAlerts VBAIsTrusted = Not mpVBC Is Nothing End Function -- __________________________________ HTH Bob "MikeZz" wrote in message ... I have a macro that requires this option to be checked. "Trust access to visual basic project" I know the only way to check the box is either manually or through Send Keys. Is there a way through some property to see if it is checked or unchecked? If there is, I can shut the macro down prior to it crashing with a dialog box telling the user what to do to enable all the features. This would really help! Thanks, MikeZz |
All times are GMT +1. The time now is 10:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com