Had a problem with an Access application that requires the Outlook library to email. Some users were using office 2003 (office 11) and others office 2007 (office 12). The access app is running in the 2003 runtime. We were getting ‘Library not Registered’ errors when users were using office 12 when the reference was pointing to the office 11 version. You can’t reference BOTH versions, so I wrote some code to remove any existing outlook references and detect and set the proper reference when the main switchboard loads.
’remove any references to outlook (this is probably mine from development)
Dim referenceItem As Reference
For Each referenceItem In References
If (referenceItem.FullPath = “C:\Program Files\Microsoft Office\OFFICE11\MSOUTL.OLB”) Then
References.Remove referenceItem
ElseIf (referenceItem.FullPath = “C:\Program Files\Microsoft Office\OFFICE12\MSOUTL.OLB”) Then
References.Remove referenceItem
End If
Next referenceItem
‘find a reference and use it
If (Dir(“C:\Program Files\Microsoft Office\OFFICE11\MSOUTL.OLB”) <> “”) Then
References.AddFromFile “C:\Program Files\Microsoft Office\OFFICE11\MSOUTL.OLB”
ElseIf (Dir(“C:\Program Files\Microsoft Office\OFFICE12\MSOUTL.OLB”) <> “”) Then
References.AddFromFile “C:\Program Files\Microsoft Office\OFFICE12\MSOUTL.OLB”
End If
