Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trap error in: ThisWorkbook.VBProject.References.Item(i).FullPath | Excel Programming | |||
Unprotecting the VBProject | Excel Programming | |||
Documentation for VBProject | Excel Programming | |||
VBProject events? | Excel Programming |