ActiveSheet.MailEnvelope [英] ActiveSheet.MailEnvelope
问题描述
一直试图用vba发送电子邮件,但是我遇到了邮件信封的异常问题,并且看到了许多关于此精致对象的未解决问题.
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.
但是现在它锁定了cos,我正在发送一条消息,发件人字段为空.
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,
但是我找不到合适的语法来做到这一点: .Item.From ="me@email.com"
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
推荐答案
.From"是.SentOnBehalfOfName
".From" is .SentOnBehalfOfName
.SentOnBehalfOfName = "me@email.com"
https://msdn.microsoft.com/en-us/library/office/ff862145.aspx
这篇关于ActiveSheet.MailEnvelope的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!