'Run-time error 13: Type mismatch' occurs for CreateObject("Outlook.Application")
Greetings Access Colleagues:
The code snippet below fails with the error, 'Run-time error 13: Type mismatch'. I have perused many sites and forums during the past few hours but without securing a fix for this problem. My software environment is Windows XP SP3 and Microsoft Office 2003 Professional.
I have verified that the Microsoft Outlook 11.0 Object Library reference is, indeed, selected. The following test verifies this. When I enter the beginning of the statement, "Dim objOutlook as Outlook.", the dropdown list of properties appears, of which 'Application' is a choice. When I deselect the object library reference, the dropdown list does not appear.
My larger goal is to employ the VBA automation feature within Access 2003 to send Outlook 2003 email but first things first. The purpose of my query is to determine how to set the 'Outlook.Application' object variable for subsequent use within my application. Thanks in advance for any help rendered.
Cheers,
Lawrence
_____
Sub AutomationTest()
Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
On Error GoTo Error1:
'*** This is the code line that fails ***
Set objOutlook = CreateObject("Outlook.Application")
Exit Sub
Error1:
MsgBox Err.Number, Err.Description
End Sub
Greetings Access Colleagues:
The code snippet below fails with the error, 'Run-time error 13: Type mismatch'. I have perused many sites and forums during the past few hours but without securing a fix for this problem. My software environment is Windows XP SP3 and Microsoft Office 2003 Professional.
I have verified that the Microsoft Outlook 11.0 Object Library reference is, indeed, selected. The following test verifies this. When I enter the beginning of the statement, "Dim objOutlook as Outlook.", the dropdown list of properties appears, of which 'Application' is a choice. When I deselect the object library reference, the dropdown list does not appear.
My larger goal is to employ the VBA automation feature within Access 2003 to send Outlook 2003 email but first things first. The purpose of my query is to determine how to set the 'Outlook.Application' object variable for subsequent use within my application. Thanks in advance for any help rendered.
Cheers,
Lawrence
_____
Sub AutomationTest()
Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
On Error GoTo Error1:
'*** This is the code line that fails ***
Set objOutlook = CreateObject("Outlook.Application")
Exit Sub
Error1:
MsgBox Err.Number, Err.Description
End Sub