Just a heads up that will use M2 from whatever sheet you have open in excel. If you dont want to deal with that you can use this code:
ActiveWorkbook.Sheets("Rent Tracker").Range("M2")
This will make it so it will use M2 on the specified sheet mine is "Rent Tracker" Note that this is case sensitive. So your code will look like this: Just change the sheet name.
TempFilePath = Environ$("temp") & "\"
TempFileName = "Fuel " & " " & Format(Now, "dd-mmm-yy")
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With Destwb
.SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
On Error Resume Next
With OutMail
.To = ActiveWorkbook.Sheets("YOUR SHEET NAME HERE").Range("M2")
.CC = ""
.BCC = ""
.Subject = "Fuel"
.Body = "Dear Sir,"
.Attachments.Add Destwb.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
.Close savechanges:=False
End With
Bookmarks