我目前正在编写一个 vba 宏来发送电子邮件,并且创建了消息,但由于生成了错误而不会发送。我目前的代码是:
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
有谁知道如何解决这一问题?
提前致谢。