Hello guys I have a macro that will automatically email a spreadsheet when i click the macro button. However I am trying to tweak it to where the subject line references ='Daily Numbers'!A3 (the terminal ID the spreadsheet is for) at the beginning of the subject line. So the end product needs to look like this....
TID = ='Daily Numbers'!A3
Below is my email macro that I currently have. Any help is greatly appreciated!
Code:
TID Proactive Pickup Recap XX/XX to XX/XX
TID = ='Daily Numbers'!A3
Below is my email macro that I currently have. Any help is greatly appreciated!
Code:
Public Sub EmailButton()
Dim newWorkbookName As String, newWorkbookFullName As String
Dim oApp As Object
Dim oMail As Object
With ThisWorkbook
newWorkbookName = "Proactive Pickup Recap.xls" 'name of the new workbook containing the 2 sheets
newWorkbookFullName = .Path & "\" & newWorkbookName
.Sheets(Array("Daily Analysis", "RT - Missed Non-TPRs", "RT - NF Per Driver", "Arrive After Closes")).Copy
ActiveWorkbook.SaveAs Filename:=newWorkbookFullName, FileFormat:=.FileFormat
ActiveWorkbook.Close False
End With
'Create an Outlook object and new mail message
Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
With oMail
.To = ""
.Subject = "[TID] Proactive Pickup Recap XX/XX to XX/XX"
.body = ""
.Attachments.Add newWorkbookFullName
.Display 'or .Send
End With
' Delete's created workbook off of computer.
Kill newWorkbookFullName
Set oMail = Nothing
Set oApp = Nothing
End Sub