Domine o Excel ® (3 em 1): Excel - 70 Fórmulas Incríveis, Excel - 51 Macros incríveis e 51 Dicas e Truques Incríveis

(Carla ScalaEjcveS) #1

Case Else: Exten = ".xlsb": FormtN = 50
End Select
End If
End With
TempFilePath = Environ$("temp") & "\"
TempFileFolder = "Part of " & OriginWKB.Name & " " & Format(Now,
"dd-mmm-yy h-mm-ss")
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With DestWKB
.SaveAs TempFilePath & TempFileFolder & Exten,
FileFormat:=FormtN
On Error Resume Next
With OutMail
.to = " [email protected] "
.CC = " [email protected] "
.BCC = " [email protected] "
.Subject = " Assunto do e-mail "
.Body = " Texto do e-mail "
.Attachments.Add (" C:\Arquivo_Exemplo.txt ")


. Send
End With
On Error GoTo 0
.Close savechanges:=False
End With
Kill TempFilePath & TempFileFolder & Exten
Set OutMail = Nothing
Set OutApp = Nothing
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub


46. Enviar e-mail com uma seleção como anexo


Esta rotina cria um arquivo a partir de uma seleção de células, este arquivo
será enviado por e-mail através do Outolook.

Free download pdf