I have some VBA which emails a range of cells, and attaches itself the email and sends.
This first time I run the macro it works fine. If I try to run it again I get the above error. Saving the work book (without closing) "resets" the issue and I can use the macro again; opening/closing has the same positive effect. I cannot see any open processes is process manager.
Any suggestions?
This first time I run the macro it works fine. If I try to run it again I get the above error. Saving the work book (without closing) "resets" the issue and I can use the macro again; opening/closing has the same positive effect. I cannot see any open processes is process manager.
Any suggestions?
VBA Code:
Option Explicit
Sub Mail()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Mail Form")
sh.Range("B11:J22").Select
With Selection.Parent.MailEnvelope.Item
.to = "email@gmail.com"
.Subject = "Subject Line: " & Range("D5").Value
.Attachments.Add (ThisWorkbook.FullName)
.send
End With
MsgBox "Your request has been submitted"
End Sub