Hi All,
so I have two issues with the code below:
1. I am attempting to create a macro that e-mail seperate e-mail addresses with separate attachments based on the cells in the homesheet. However, when I run it, I get a 'select method of worksheet failed' error at. When I attempt again to run it, it works. I'd prefer it if it worked first time round everytime.PHP Code:
Parent.Select
2. Then when the code runs, it does everything I want except there is a divider in the e-mail body between the 'Intro' and the rest of the body which I'd like to remove.
Appreciate any advice on this.
PHP Code:
Sub Send_Range_Or_Whole_Worksheet_with_MailEnvelope()
sn = Sheets("Contacts").Cells(1).CurrentRegion.Value
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
For i = 2 To UBound(sn)
ActiveWorkbook.EnvelopeVisible = True
Set Sendrng = Sheets(sn(i, 1)).Range("A1:M71")
With Sendrng
.Parent.Select
With .Parent.MailEnvelope
.Introduction = sn(i, 4)
With .Item
.To = sn(i, 2)
.Subject = sn(i, 3)
.Attachments.Add sn(i, 5)
.Send
End With
End With
End With
Next
ActiveWorkbook.EnvelopeVisible = False
With Application
.Goto Sheets("Contacts").Range("A1")
.ScreenUpdating = False
.EnableEvents = False
End With
End Sub
Bookmarks