Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default ThisWorkbook.VBProject.References

Hello all,
I have a spreadsheet that I wish to ensure that users have the TRUST
ACCESS TO VISUAL BASIC PROJECT checked. I am running a CALL
CHECKTRUST statement from the workbook_open statement. I have
computers running OfficeXP and Office2003.

When I run the code to test whether the option is checked on a machine
with Office 03 my Ref object returns a value. On a machine with
OfficeXP the Ref object returns "Nothing" even though the TRUST option
is checked. The call to AddReference in the code below removes
missing links and adds libraries based on GUIDS. Any thoughts about
making Checktrust to work on the OfficeXP machines appreaciated.
Thanks in Advance!

Sub Checktrust()
Dim Ref As Object
On Error Resume Next
Set Ref = ThisWorkbook.VBProject.References("Excel")
If Ref Is Nothing Then
MsgBox "Your Excel settings will need to be updated to run
this version of the eForm. " & vbNewLine & _
"1. From the menu, select TOOLS | MACRO | Security " &
vbNewLine & _
"2. Then go to the Trusted Sources tab, " & vbNewLine & _
"3. Check the box { TRUST ACCESS TO VISUAL BASIC PROJECT }
setting" & vbNewLine & _
"4. Exit Excel then open this file again. This is needed only
once", vbOKOnly
Else
Call AddReference
End If
endsub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default ThisWorkbook.VBProject.References

This is how I determine if VB access is trusted:

Sub TestVBE_Trusted()
If VBE_Trusted Then
MsgBox "VBE Trusted"
Else
MsgBox "VBE NOT Trusted"
End If
End Sub

Function VBE_Trusted() As Boolean
Dim X As Variant
On Error Resume Next
Err.Clear
X = Application.VBE.Version
VBE_Trusted = (Err.Number = 0)
End Function

--
Jim
"bluegrassstateworker" wrote in message
...
| Hello all,
| I have a spreadsheet that I wish to ensure that users have the TRUST
| ACCESS TO VISUAL BASIC PROJECT checked. I am running a CALL
| CHECKTRUST statement from the workbook_open statement. I have
| computers running OfficeXP and Office2003.
|
| When I run the code to test whether the option is checked on a machine
| with Office 03 my Ref object returns a value. On a machine with
| OfficeXP the Ref object returns "Nothing" even though the TRUST option
| is checked. The call to AddReference in the code below removes
| missing links and adds libraries based on GUIDS. Any thoughts about
| making Checktrust to work on the OfficeXP machines appreaciated.
| Thanks in Advance!
|
| Sub Checktrust()
| Dim Ref As Object
| On Error Resume Next
| Set Ref = ThisWorkbook.VBProject.References("Excel")
| If Ref Is Nothing Then
| MsgBox "Your Excel settings will need to be updated to run
| this version of the eForm. " & vbNewLine & _
| "1. From the menu, select TOOLS | MACRO | Security " &
| vbNewLine & _
| "2. Then go to the Trusted Sources tab, " & vbNewLine & _
| "3. Check the box { TRUST ACCESS TO VISUAL BASIC PROJECT }
| setting" & vbNewLine & _
| "4. Exit Excel then open this file again. This is needed only
| once", vbOKOnly
| Else
| Call AddReference
| End If
| endsub


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
Trap error in: ThisWorkbook.VBProject.References.Item(i).FullPath Dennis Excel Programming 4 November 8th 06 07:03 PM
Unprotecting the VBProject jstrater Excel Programming 4 May 16th 04 04:01 PM
Documentation for VBProject Wes Jester Excel Programming 2 September 30th 03 06:26 PM
VBProject events? Chip Pearson Excel Programming 0 September 10th 03 10:36 AM


All times are GMT +1. The time now is 09:48 PM.

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"