ActiveSheet.MailEnvelope

风流意气都作罢 提交于 2019-12-12 00:32:34

问题


have been trying to send email with vba , but i ran in to an unusual problem with the mail envelope, and have seen lots of unanswered problems with this delicate object.

I have discovered through debugging that it locks up when trying to send following code, one problem i resolved was that I needed a range to be selected.

BUT now it is locking up cos i am sending a message with the from field empty.

if i add a break point, add the field manually then resume all goes well,

but i cannot find the proper syntax to do this: .Item.From = "me@email.com"

ActiveWorkbook.EnvelopeVisible = True

'    On Error Resume Next

With ActiveSheet.MailEnvelope
    .Item.To = tech
    .Item.Subject = "some words"
    .Introduction = "some more words"
    ActiveSheet.Range("A1:G5").Select

                 //           from line goes here

    .Send

End With

ActiveWorkbook.EnvelopeVisible = False
On Error GoTo 0

回答1:


".From" is .SentOnBehalfOfName

.SentOnBehalfOfName = "me@email.com"

https://msdn.microsoft.com/en-us/library/office/ff862145.aspx



来源:https://stackoverflow.com/questions/31795075/activesheet-mailenvelope

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