The following macro worked perfectly for me while using Excel 2013 and Outlook 2013. I recently upgraded to Excel 2016 and Office 2016 and the macro no longer works. It just leaves me sitting on the worksheet that is supposed to be the content of the email and nothing happens in Outlook. What am I doing wrong??
Many Thanks in Advance,
Steve
Sub Email_Thank_You_Note()
Dim AWorksheet As Worksheet
Dim Sendrng As Range
Dim rng As Range
On Error GoTo StopMacro
Dim Resp As String
Resp = MsgBox("Please confirm ALL POST-PROJECT DATA is COMPLETE and you want to send a THANK YOU email to client.", vbOKCancel + vbExclamation + vbDefaultButton2, "Order Confirmation")
If Resp = vbCancel Then
End ' This ends the macro
End If
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'Fill in the Worksheet/range you want to mail
'Note: if you use one cell it will send the whole worksheet
Set Sendrng = Worksheets("Thank You Note").Range("A1:C27")
'Remember the activesheet
Set AWorksheet = ActiveSheet
'Create the mail and send it
With Sendrng
' Select the worksheet with the range you want to send
.Parent.Select
'Remember the ActiveCell on that worksheet
Set rng = ActiveCell
'Select the range you want to mail
.Select
' Create the mail and send it
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."
' In the "With .Item" part you can add more options
' See the tips on this Outlook example page.
' http://www.rondebruin.nl/mail/tips2.htm
With .Item
.to = Sheets("Painting").Range("J7").Value
' Denis wants to use Foxboroorders@babels.com for now
.Subject = "Thank You"
.DeferredDeliveryTime = DateAdd("d", 7, Now)
.Send
End With
End With
'select the original ActiveCell
rng.Select
End With
'Activate the sheet that was active before you run the macro
AWorksheet.Select
StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False
End Sub
Many Thanks in Advance,
Steve
Sub Email_Thank_You_Note()
Dim AWorksheet As Worksheet
Dim Sendrng As Range
Dim rng As Range
On Error GoTo StopMacro
Dim Resp As String
Resp = MsgBox("Please confirm ALL POST-PROJECT DATA is COMPLETE and you want to send a THANK YOU email to client.", vbOKCancel + vbExclamation + vbDefaultButton2, "Order Confirmation")
If Resp = vbCancel Then
End ' This ends the macro
End If
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'Fill in the Worksheet/range you want to mail
'Note: if you use one cell it will send the whole worksheet
Set Sendrng = Worksheets("Thank You Note").Range("A1:C27")
'Remember the activesheet
Set AWorksheet = ActiveSheet
'Create the mail and send it
With Sendrng
' Select the worksheet with the range you want to send
.Parent.Select
'Remember the ActiveCell on that worksheet
Set rng = ActiveCell
'Select the range you want to mail
.Select
' Create the mail and send it
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."
' In the "With .Item" part you can add more options
' See the tips on this Outlook example page.
' http://www.rondebruin.nl/mail/tips2.htm
With .Item
.to = Sheets("Painting").Range("J7").Value
' Denis wants to use Foxboroorders@babels.com for now
.Subject = "Thank You"
.DeferredDeliveryTime = DateAdd("d", 7, Now)
.Send
End With
End With
'select the original ActiveCell
rng.Select
End With
'Activate the sheet that was active before you run the macro
AWorksheet.Select
StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = False
End Sub