Hello!
I am currently writing a vba macro to send e-mails and the messages are created but do not sent as an error is generated. My current code is:
Function CreateHURMail(Filename)
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = New Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)
With objMail
.Subject = "Test Message"
.Body = "Body Text"
.To = "abc@xyz"
.Attachments.Add (Filename)
.Display
On Error Resume Next
.Send
'If Err.Number = 287 Then
' MsgBox "Still doesn't work!", vbOKOnly, "DOH!"
'End If
End With
End Function
Does anyone know how to fix this?
Thanks in advance.