View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
bluegrassstateworker bluegrassstateworker is offline
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