ExcelMonkey,
Check your reference list for missing references.
For example, do you have a reference set to MS VBA Extensibility? It may be
a new version, so perhaps you have lost your reference to that - or to
another file.
HTH,
Bernie
MS Excel MVP
"ExcelMonkey" <ExcelMonkey@discussions.microsoft.com> wrote in message
news:CA7FCAF9-1477-478D-ABA4-F07DAF0F384B@microsoft.com...
> The following macro is no longer working. I am getting a Run Time Error
> 1004
> saying "Programmatic Access to Visual Basic Project not Trusted". It's
> highlighting the line of code:
>
> For Each ref In ThisWorkbook.VBProject.References
>
> I have the Regular Expressions 5.5 clicked off. This was working fine in
> XL
> 2000 until I merged two XLAs together and started running it in XL 2003
>
> Why is this?
>
>
> Private Sub ExternalLinkChkBx_Click()
> Dim ref As Object
> Dim fRef As Boolean
>
> If ExternalLinkChkBx = False Then
> SelectAllChkBx = False
> End If
>
> If ExternalLinkChkBx = True Then
> 'Check to see if user has RegExp library
> 'installed. If not, prompt user to not
> 'choose this option.
> For Each ref In ThisWorkbook.VBProject.References
> If ref.Name = "VBScript_RegExp_55" Then
> 'Debug.Print ref.Name
> 'ThisWorkbook.VBProject.References.Remove ref
> fRef = True
> 'MsgBox ("Regular Expressions 5.5 Enabled")
> End If
> Next
> If Not fRef Then MsgBox ("You do not have the Regular Expressions
> Library checked off in the Tools Menu. In order for this External Link
> Audit
> to be completed, you need to reference this library. Go to to the VB
> Editor
> and then to Tools/References. Scroll down to Microsoft VBScript Regular
> Expressions 5.5 and click on it. Then run this audit again.")
> If Not fRef Then ExternalLinkChkBx = False
>
> End If
> End Sub
Bookmarks