- 04 Jan 2017 às 10:57
#18619
Bom dia! Por favor, gostaria de selecionar 2 ranges para enviar por email, contudo, não sei se é possível. Tentei algumas combinações diferentes como
ActiveSheet.Range("A2:D7").Select, ActiveSheet.Range("A19:D24").Select
ou
ActiveSheet.Range("A2:D7,A19:D24").Select
... mas não consigo envelopar 2 seleções diferentes. Anexo arquivo de teste funcional. Mas preciso selecionar e envelopar 2 ranges diferentes.
Sub EnviarTeste()
' Select the range of cells on the active worksheet.
ActiveSheet.Range("A2:D7").Select
' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = True
' Set the optional introduction field thats adds
' some header text to the email body. It also sets
' the To and Subject lines. Finally the message
' is sent.
With ActiveSheet.MailEnvelope
.Item.To = ActiveSheet.Range("F2").Text
.Item.Subject = ActiveSheet.Range("F3").Text
.Item.Send
End With
End Sub
ActiveSheet.Range("A2:D7").Select, ActiveSheet.Range("A19:D24").Select
ou
ActiveSheet.Range("A2:D7,A19:D24").Select
... mas não consigo envelopar 2 seleções diferentes. Anexo arquivo de teste funcional. Mas preciso selecionar e envelopar 2 ranges diferentes.
Sub EnviarTeste()
' Select the range of cells on the active worksheet.
ActiveSheet.Range("A2:D7").Select
' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = True
' Set the optional introduction field thats adds
' some header text to the email body. It also sets
' the To and Subject lines. Finally the message
' is sent.
With ActiveSheet.MailEnvelope
.Item.To = ActiveSheet.Range("F2").Text
.Item.Subject = ActiveSheet.Range("F3").Text
.Item.Send
End With
End Sub
Você não está autorizado a ver ou baixar esse anexo.