The codes below works perfectly, but when I un-comment 'range("a1:c6").select, the macro goes crazy and go into a continuous loop. I only want to send range a1:a6 as body instead of the whole sheet.
Sub email()
'//////////////////////SEND EMAIL////////////////////////////////
Sheets("lagg").Select
'range("a1:c6").select
Dim email As String
Dim Sendrng As Range
On Error GoTo StopMacro
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'Note: if the selection is one cell it will send the whole worksheet
Set Sendrng = Selection
'Create the mail and send it
With Sendrng
ActiveWorkbook.EnvelopeVisible = True
With .Parent.MailEnvelope
' Set the optional introduction field thats adds
' some header text to the email body.
.Introduction = "This is a test mail."
With .Item
.To = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "Test " & Format(Now() - 1, "mm.dd.yy")
.SEnd
End With
End With
End With
StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False
End Sub
Bookmarks