harryhoudini66
Technical User
Hello again,
I have a script that I created (googled it really) that creates an e-mail and attaches a document. I need some help relating to the subject line for the e-mail.
Why? Well there is an e-mail that is sent out four times (6:00am, 11:00am, 3:00pm, 7:00pm) per day that includes an attachment (Thanks again Skip for helping). I plan on using Windows Scheduler to schedule these four events. The reason I want to use a script is that users are constantly forgetting to enter the date or time interval in the subject line.
6:00am Report: This includes prior day information. I need the subject line to show the prior day's date. The script I have listed works for current date only.
11:00am Report: This report contains todays data for the 700am-11:00am interval period. Therefore the subject line has to read “Interval Report [Current Date] 7:00am-11:00am. I am not sure how to add the 7:00am-11:00am text to the subject line.
3:00pm Report: Same request as above except the interval period would be 11:00am-3:00pm. The subject line needs to read "Interval Report [Current Date] 11:00am-3:00pm"
7:00pm Report: Same request as above except the interval period would be 3:00pm-7:00pm
The subject line needs to read "Interval Report [Current Date] 3:00pm-7:00pm"
Thank you all in advance for your help.
Much appreciated.
============
Dim objOutl
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
'comment the next line if you do not want to see the outlook window
objMailItem.Display
strEmailAddr = "recipient@email.com"
objMailItem.Recipients.Add strEmailAddr
objMailItem.Subject = "Interval Report "& Date
objMailItem.HTMLBody = "My HTML Text Goes Here"
objMailItem.Attachments.Add "\\fileserver2\MSC\MSC_Reports\Interval\MSCInteReportvWindows_7.xlsx"
objMailItem.Display
Set objMailItem = nothing
Set objOutl = nothing
=============
I have a script that I created (googled it really) that creates an e-mail and attaches a document. I need some help relating to the subject line for the e-mail.
Why? Well there is an e-mail that is sent out four times (6:00am, 11:00am, 3:00pm, 7:00pm) per day that includes an attachment (Thanks again Skip for helping). I plan on using Windows Scheduler to schedule these four events. The reason I want to use a script is that users are constantly forgetting to enter the date or time interval in the subject line.
6:00am Report: This includes prior day information. I need the subject line to show the prior day's date. The script I have listed works for current date only.
11:00am Report: This report contains todays data for the 700am-11:00am interval period. Therefore the subject line has to read “Interval Report [Current Date] 7:00am-11:00am. I am not sure how to add the 7:00am-11:00am text to the subject line.
3:00pm Report: Same request as above except the interval period would be 11:00am-3:00pm. The subject line needs to read "Interval Report [Current Date] 11:00am-3:00pm"
7:00pm Report: Same request as above except the interval period would be 3:00pm-7:00pm
The subject line needs to read "Interval Report [Current Date] 3:00pm-7:00pm"
Thank you all in advance for your help.
Much appreciated.
============
Dim objOutl
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
'comment the next line if you do not want to see the outlook window
objMailItem.Display
strEmailAddr = "recipient@email.com"
objMailItem.Recipients.Add strEmailAddr
objMailItem.Subject = "Interval Report "& Date
objMailItem.HTMLBody = "My HTML Text Goes Here"
objMailItem.Attachments.Add "\\fileserver2\MSC\MSC_Reports\Interval\MSCInteReportvWindows_7.xlsx"
objMailItem.Display
Set objMailItem = nothing
Set objOutl = nothing
=============