Hello,
I'm having problems with this method: if I send more than one consecutive email I have the runtime error "method 'mail envelope' of the _worksheet object failed.
How can I solve? I need to use this method more than once in the same Excel session.
I'm having problems with this method: if I send more than one consecutive email I have the runtime error "method 'mail envelope' of the _worksheet object failed.
How can I solve? I need to use this method more than once in the same Excel session.
VBA Code:
''''''''''Open Outlook
On Error Resume Next
Set oOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0
If oOutlook Is Nothing Then
Shell ("OUTLOOK")
Else
End If
''''''''''SELECT CELLS
mail.Select
Dim lr As Integer
lr = mail.Range("A" & Application.Rows.Count).End(xlUp).Row
mail.Range("A1:B" & lr).Select
mail.Activate
''''''''''SEND EMAIL
With Selection.Parent.MailEnvelope.Item
.To = mail.Range("E1").Value
.CC = mail.Range("E2").Value
.Subject = mail.Range("E3").Value
.Attachments.Add mail.Range("E4").Value
.Send
End With