- 26 Jul 2017 às 11:06
#25062
Bom dia amigos!
Estou com uma macro que envia e-mails através de um intervalo de células. O destinatário, o assunto e o corpo do e-mail estão em intervalor.
Segue o código:
Obrigada desde já!!
Estou com uma macro que envia e-mails através de um intervalo de células. O destinatário, o assunto e o corpo do e-mail estão em intervalor.
Segue o código:
Código: Selecionar todos
Entretanto, eu gostaria que antes de enviar o e-mail, a macro deixasse ele aberto para que eu enviasse ele manualmente. O .display não está dando certo :/Sub Send_Range_Or_Whole_Worksheet_with_MailEnvelope()
'Working in Excel 2002-2016
Dim AWorksheet As Worksheet
Dim Sendrng As Range
Dim rng As Range
Dim destinatario As Range
Dim assunto As Range
On Error GoTo StopMacro
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("Plan1").Range("B1:Q19")
'Remember the activesheet
Set AWorksheet = ActiveSheet
Set destinatario = Worksheets("E-mail").Range("L11")
Set assunto = Worksheets("E-mail").Range("L13")
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
With .Item
.To = destinatario.Value
.Subject = assunto.Value
.display
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
Obrigada desde já!!