PC Review


Reply
Thread Tools Rate Thread

How can I verify if "Trust access to visual basic project" is chec

 
 
MikeZz
Guest
Posts: n/a
 
      28th Jul 2008
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 With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      28th Jul 2008

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" <(E-Mail Removed)> wrote in message
news:CE960EA4-101B-423E-8F90-(E-Mail Removed)...
>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 With Quote
 
MikeZz
Guest
Posts: n/a
 
      28th Jul 2008
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" <(E-Mail Removed)> wrote in message
> news:CE960EA4-101B-423E-8F90-(E-Mail Removed)...
> >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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Trust Access to Visual Basic Project" checked but getting error 6 AsimHussain Microsoft Excel Programming 2 7th May 2009 04:15 PM
"Trust Access to Visual Basic Project" checked but getting error 6 AsimHussain Microsoft Excel Programming 0 6th May 2009 03:59 PM
"trust access to visual basic project" option =?Utf-8?B?QXJ0aHVy?= Microsoft Access 2 13th Oct 2006 08:22 AM
"trust access to visual basic project" option =?Utf-8?B?QXJ0aHVy?= Microsoft Access Macros 0 13th Oct 2006 04:48 AM
Registry key for "Trust access to Visual Basic project" tmarko Microsoft Excel Programming 3 14th Jun 2004 10:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:28 PM.