The following code works perfectly in A2k, but gives a -2147024770 error in A2k3 on my client's workstation:
Do I need a reference set to a newer outlook library? If so, how can I do that if I don't have A2k3 installed?
Thanks,
Sup
Code:
Sub CreateMailItem(strRecip As String, strHome As String, strAttach1 As String, Optional strAttach2 As String, Optional strAttach3 As String)
'make a reference to Microsoft outlook 9.0 library
Dim objolk As Outlook.Application
Dim objMailItem As Outlook.MailItem
Dim olkNameSpace
On Error GoTo CreateMailItem_Error
Set objolk = New Outlook.Application
Set olkNameSpace = objolk.getNameSpace("MAPI")
Set objMailItem = objolk.CreateItem(olMailItem)
objMailItem.To = strRecip
objMailItem.Subject = strHome & " Forms"
objMailItem.body = "Attached are Encounter Forms"
objMailItem.attachments.Add strAttach1
objMailItem.attachments.Add strAttach2
objMailItem.attachments.Add strAttach3
objMailItem.Display
'objMailItem.Send
Set objMailItem = Nothing
Set objolk = Nothing
On Error GoTo 0
Exit Sub
CreateMailItem_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CreateMailItem of VBA Document Form_frmAdminContacts"
End Sub
Do I need a reference set to a newer outlook library? If so, how can I do that if I don't have A2k3 installed?
Thanks,
Sup