Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trust Access to Visual Basic Project tcb Excel Programming 0 January 9th 08 06:39 PM
Trust access to visual basic project is grayed out [email protected] Excel Programming 3 September 22nd 06 04:07 PM
Trust Access to Visual Basic Project Farah[_7_] Excel Programming 0 November 7th 05 01:17 PM
Trust access to visual basic project in XP systems kasi Excel Discussion (Misc queries) 5 October 13th 05 01:32 PM
Registry key for "Trust access to Visual Basic project" tmarko[_13_] Excel Programming 3 June 14th 04 10:40 AM


All times are GMT +1. The time now is 03:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"