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
".From" is .SentOnBehalfOfName
https://msdn.microsoft.com/en-us/library/office/ff862145.aspx