I have an Access database that imports Outlook contacts.
However some of the machines the program will be installed
on do not have outlook. Thus the reference to MSOUTL.OLB
(Microsoft Outloook 10 object library) is "Missing". I can
check to see if Outlook is installed and which version it
is. I need to either add a reference or delete it during
runtime depending on whether Outlook is installed. I am using the following code which works fine in
the development environment as an mdb but gives the following error as an mde file:
ERROR
40179: Requested type library or wizard is not a VBA project
CODE
Function ReferenceFromFile(strFileName As String) As
Boolean
Dim Ref As Reference
On Error GoTo Error_ReferenceFromFile
' Create new reference.
Set Ref = References.AddFromFile(strFileName)
ReferenceFromFile = True
Exit_ReferenceFromFile:
Exit Function
And
Function RemoveReference(strName As String) As Boolean
Dim Outref As Access.Reference
On Error GoTo Error_ReferenceFromFile
' Remove reference.
Set Outref = Access.References(strName)
Access.References.Remove Outref
Set Outref = Nothing
RemoveReference = True
Exit_RemoveReference:
Exit Function
during runtime as an .mde file on the target machine the following error occurs.
ERROR
-2147319779: Method 'Item of object'_References' failed.
Does anyone have any suggestions?
Thanks
Stewart
However some of the machines the program will be installed
on do not have outlook. Thus the reference to MSOUTL.OLB
(Microsoft Outloook 10 object library) is "Missing". I can
check to see if Outlook is installed and which version it
is. I need to either add a reference or delete it during
runtime depending on whether Outlook is installed. I am using the following code which works fine in
the development environment as an mdb but gives the following error as an mde file:
ERROR
40179: Requested type library or wizard is not a VBA project
CODE
Function ReferenceFromFile(strFileName As String) As
Boolean
Dim Ref As Reference
On Error GoTo Error_ReferenceFromFile
' Create new reference.
Set Ref = References.AddFromFile(strFileName)
ReferenceFromFile = True
Exit_ReferenceFromFile:
Exit Function
And
Function RemoveReference(strName As String) As Boolean
Dim Outref As Access.Reference
On Error GoTo Error_ReferenceFromFile
' Remove reference.
Set Outref = Access.References(strName)
Access.References.Remove Outref
Set Outref = Nothing
RemoveReference = True
Exit_RemoveReference:
Exit Function
during runtime as an .mde file on the target machine the following error occurs.
ERROR
-2147319779: Method 'Item of object'_References' failed.
Does anyone have any suggestions?
Thanks
Stewart