Hello
Hello
This Code meant to Create a Sheet from details of Pivot table,
move the sheet to New Workbook
save the new workbook
Attach the New Workbook to an email
Everything it is fine except the Email message has no attachement
Any Idea where it went wrong ?
Thanks
Sub AttachtoEmail()
Sheets("Pivot AR").Select
Range("C5").Select
Selection.ShowDetail = True
ActiveSheet.Name = "Extrait de Compte"
Sheets("Extrait").Select
varPath = ThisWorkbook.Path
Sheets("Extrait de Compte").Select
Sheets("Extrait de Compte").Move
ActiveWorkbook.SaveAs Filename:=varPath & "\" & [C11] & "_" & [E11] & Format(Range("C8"), "ddmmmyyyy") & ".xls"
'Email
Application.DisplayAlerts = False
Dim myOutlok As Object
Dim myMailItm As Object
Set otlApp = CreateObject("Outlook.Application")
Set otlNewMail = otlApp.CreateItem(olMailItem)
fName = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
With otlNewMail
.To = [C12]
.CC = [p1]
.Subject = "TaylorMade adidas Golf EXTRAIT DE COMPTE - " & [H13]
.Body = "Hello" & [e21] & Chr(13) & Chr(13) & "Please see Statement attached."
.Display
End With
'Application.SendKeys "%s"
Set otlNewMail = Nothing
Set otlApp = Nothing
Set otlAttach = Nothing
Set otlMess = Nothing
Set otlNSpace = Nothing
ActiveWindow.Close
End Sub
Bookmarks