Public Function SetupEmail(strSendTo As String, strSubject As String, strMsg As String) As Boolean
Dim olkApp As Object
Dim olkMsg As Object
Const strProcedure As String = "SetupEmail"
10 On Error GoTo ErrorHandler
20 Set olkApp = CreateObject("Outlook.Application")
30 With olkApp
40 Set olkMsg = .CreateItem("Outlook.MailItem") '<== 'Object mis-match here
50 With olkMsg
60 .Recipients.Add strSendTo
100 .Subject = strSubject
110 .Body = strMsg
120 .Display
130 End With
140 End With
150 SetupEmail = True
ExitFunction:
160 On Error Resume Next
170 Set olkMsg = Nothing
180 Set olkApp = Nothing
190 On Error GoTo 0
200 Exit Function
ErrorHandler:
210 HandleError strModule, strProcedure, Err.Description, Err.Number, Erl
220 Resume ExitFunction
End Function
|