Originally Posted by
fumei
Oh and in case you missed it. You mention:
"Correct that reference and the problem should go away."
I can NOT correct any reference as they will not persist.
Get it?
I was not referring to the reference that is being added.
I was referring to the reference to the VBA Extensibility 5.3 library.
If you are working from a clean install of the OS and Office, I'd suggest trying the following:
0. Create a new template.
1. Add the following to the template and run the code to see what references are included.
Private Sub ListReferences()
' Requires reference to VBA Extensibility Library 5.3
Dim ref As VBIDE.Reference
Dim strOutput As String
With Application
With .ActiveDocument
strOutput = ""
For Each ref In .VBProject.References
strOutput = strOutput & vbCrLf & ref.Name
Next ref
End With
End With
Debug.Print strOutput
Set ref = Nothing
End Sub
2. Then add and run the following code:
Private Sub AddReference()
' Requires reference to VBA Extensibility Library 5.3
Dim ref As VBIDE.Reference
Dim strOutput As String
With Application
With .ActiveDocument
strOutput = ""
For Each ref In .VBProject.References
strOutput = strOutput & vbCrLf & ref.Name
Next ref
.VBProject.References.AddFromFile FileName:="C:\Windows\system32\scrrun.dll"
strOutput = "----------------" & vbCrLf
For Each ref In ActiveDocument.VBProject.References
strOutput = strOutput & vbCrLf & ref.Name
Next ref
End With
End With
Debug.Print strOutput
Set ref = Nothing
End Sub
3. Then create another new template.
4. Try Tools | References.
If the code works, but Tools | References does not, the implication is that something is making Word unhappy. In my case, it was a missing reference in a global template. I suspect the same would occur if there were a missing reference in an add-in's template, not necessarily in the Startup directory.