George J
Well-known Member
- Joined
- Feb 15, 2002
- Messages
- 959
I have a macro that seems to work okay for older versions of Excel - I use Office XP (2002)
Can someone tell me if this will work for newer versions (2007 / 2010) please?
And if not, can anyone suggest how check this?
KB1017 - Trust access to VBA project
I was thinking that i should probably have
VBATrusted = -1
as the third line so that it is negative unless the tick is there. No way of checking older versions right now though.
All help appreciated.
Can someone tell me if this will work for newer versions (2007 / 2010) please?
And if not, can anyone suggest how check this?
KB1017 - Trust access to VBA project
Code:
Function VBATrusted() As Boolean
On Error Resume Next
VBATrusted = (Application.VBE.VBProjects.Count) > 0
Exit Function
End Function
Private Sub Workbook_Open()
If Not VBATrustedAccess() Then
MsgBox "No Access to VB Project" & vbLf & _
"Please allow access in Trusted Sources" & vbLf & _
"(Tools > Macro > Security > Trusted Source Tab)"
End If
End Sub
I was thinking that i should probably have
VBATrusted = -1
as the third line so that it is negative unless the tick is there. No way of checking older versions right now though.
All help appreciated.