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

Dest.Sheets(1).Cells(1).Select
Application.CutCopyMode = False
iTempFolder = Environ$("temp") & "\"
iTempFile = "Selection of " & wb.Name & " " & Format(Now, "dd-mmm-
yy h-mm-ss")
If Val(Application.Version) < 12 Then
iExt = ".xls": iFormatNum = -4143
Else
iExt = ".xlsx": iFormatNum = 51
End If
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With Dest
.SaveAs iTempFolder & iTempFile & iExt, FileFormat:=iFormatNum
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 iTempFolder & iTempFile & iExt
Set OutMail = Nothing
Set OutApp = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub

Free download pdf