我正在根据日历前景的约会自动发送重复邮件。我正在尝试将附件附加到文件夹中的邮件中。 我不知道该怎么办。
Private Sub Application_Reminder(ByVal Item As Object)
Dim objMsg As MailItem
Set objMsg = Application.CreateItem(olMailItem)
Dim Groupe1 As String
If Item.MessageClass <> "IPM.Appointment" Then
Exit Sub
End If
Dim txt As String
txt = Item.body
Dim mail As String
mail = Left(txt, InStr(1, txt, "<mailto", vbTextCompare) - 1)
Dim body As String
body = Mid(txt, InStr(1, txt, "<body>", vbTextCompare) + 6, Len(txt) - InStr(1, txt, "<body>", vbTextCompare) + 6)
If Item.Categories = "MailAuto" Then
objMsg.To = mail
objMsg.Subject = Item.Subject
objMsg.body = body
objMsg.Send
End If
Set objMsg = Nothing
End Sub
答案 0 :(得分:0)
尝试
Dim myAttachments As Outlook.Attachments
Set myAttachments = objMsg.Attachments
myAttachments.Add "C:\Test.doc"
祝你好运