I was given a new require to our daily report that is sent out. Add a datestamp to the attached file name.
Here is the VBA code I cobbled together from examples to create the basic email. What I need to do is find a way to copy the original file to a new name and attach the new file that has a date stamp.
DailyReport.xls becomes 20100223_DailyReport.xls
Thanks
John Fuhrman
faq329-6766
faq329-7301
thread329-1334328
thread329-1424438
Here is the VBA code I cobbled together from examples to create the basic email. What I need to do is find a way to copy the original file to a new name and attach the new file that has a date stamp.
DailyReport.xls becomes 20100223_DailyReport.xls
Code:
Sub Daily_Report()
Dim msg As Outlook.MailItem
Set msg = Application.CreateItem(olMailItem)
strToList = "Recip1; Recip2"
msg.To = strToList
strCCList = "CC1; CC2; CC3"
msg.CC = strCCList
msg.Subject = "Daily Report for " & Date
strSig1 = "John F Fuhrman III"
strSig2 = vbCrLf & "Title"
strSig3 = vbCrLf & "Company Name"
strSig4 = vbCrLf & "Street Address"
strSig5 = vbCrLf & "City, State Zipcode"
strSig6 = vbCrLf & "Office: "
strSig7 = vbCrLf & "Fax: "
strSig8 = vbCrLf & "Email: "
strSignature = strSig1 & strSig2 & strSig3 & strSig4 & strSig5 & strSig6 & strSig7 & strSig8
msg.Body = "Good morning," & vbCrLf & "Attached is the Daily Report." & vbCrLf & vbCrLf & vbCrLf & strSignature
msg.Display
msg.Attachments.Add ("R:\Reports\DailyReport\FY_2010_DailyReport.xls")
Set msg = Nothing
End Sub
Thanks
John Fuhrman
faq329-6766
faq329-7301
thread329-1334328
thread329-1424438