Hi Everyone,
I have some code in my Excel 2003 document to generate an email message. It references the Microsoft Office 11.0 Object Library.
Problem is, some employees do not have 11.0, they have the 10.0 Object Library. Both 11.0 and 10.0 refer to a file named MSOUTL.OLB
I'm trying to write some code to identify this issue and update the reference selection as needed when the workbook is opened but have had no luck.
My latest attempt is as follows:
This code finds a missing reference, clears it, and then attempts to relocate the file based on the registry GUID. The problem is that it even though the file is MSOUT.OLB, it is still looking for a 11.0 version instead of accepting the 10.0 version.
Any thoughts would be much appreciated!
P.S. Yes, i've tried late-binding here, but we are using .UserProperties to embed hidden variables in the email message which we can't get to work without using the object reference.
I have some code in my Excel 2003 document to generate an email message. It references the Microsoft Office 11.0 Object Library.
Problem is, some employees do not have 11.0, they have the 10.0 Object Library. Both 11.0 and 10.0 refer to a file named MSOUTL.OLB
I'm trying to write some code to identify this issue and update the reference selection as needed when the workbook is opened but have had no luck.
My latest attempt is as follows:
Code:
Dim vbProj As VBProject ' This refers to your VBA project.
Dim chkRef As Reference ' A reference.
Dim RefGUID As String
Dim refPath As String
' Refer to the activedocument's VBA project.
Set vbProj = ActiveWorkbook.VBProject
' Check through the selected references in the References dialog box.
For Each chkRef In vbProj.References
' If the reference is broken, send the name to the Immediate Window.
If chkRef.IsBroken Then
RefGUID = chkRef.Guid
refPath = chkRef.FullPath
vbProj.References.Remove chkRef
vbProj.References.AddFromGuid RefGUID, 0, 0
End If
Next
This code finds a missing reference, clears it, and then attempts to relocate the file based on the registry GUID. The problem is that it even though the file is MSOUT.OLB, it is still looking for a 11.0 version instead of accepting the 10.0 version.
Any thoughts would be much appreciated!
P.S. Yes, i've tried late-binding here, but we are using .UserProperties to embed hidden variables in the email message which we can't get to work without using the object reference.