Reply to Outlook mail from Excel

大兔子大兔子 提交于 2019-12-06 08:53:12

Since you are using Early Binding, Change

Dim olMail As Variant

to

Dim olMail As Outlook.MailItem

And then you will be able to access all the properties of the olMail item. One of which is .ReplyAll

ScreenShot

If InStr(olMail.Subject, "Blah Blah") <> 0 Then
    olMail.Display
    olMail.ReplyAll

    DoEvents

    '
    '~~> Rest of the code
    '

    i = i + 1
End If

There is a ReplyAll method which returns a mail object. See here.
So if you are iterating through some mails, then this should work:

For Each oMail in Fldr.Items
    If InStr(olMail.Subject, "mysubject") <> 0 Then
        With oMail.ReplyAll
            .Subject  = oMail.Subject '~~> this is optional
            .Body = "your Body"
            '~~> all other stuff you need your mail to have
            .Display '~~> change to .Send if it is already ok
        End With
    End If
Next

Not tested but should be close.

bigbryan

Try this one:

olMail.ReplyAll
olMail.ReplyAll.body = bodyMail & vbLF & .body
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!