Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attach Files to Outlook Message according to the date in the file name

Status
Not open for further replies.

Xeeq

Technical User
Oct 12, 2011
27
0
0
US
I currently have this code to open an email and fill in the To, Subject, Cc, and Body.

Code:
Dim objOutl
Set objOutl = CreateObject("Outlook.Application")
Set objMailItem = objOutl.CreateItem(olMailItem)
objMailItem.Display
strEmailAddr  = "mike@*********.com"; "john@********.com"; "xeeq@*******.com"
objMailItem.Recipients.Add strEmailAddr 
objMailItem.Body = "Hey, how's it going?"
objMailItem.Subject = "Whhat's up?"
objMailItem.Cc =  "more emails"

strAttachment = "More code required before I can put anything here."
objMailItem.Attachments.Add strAttachment

Set objMailItem = nothing
Set objOutl = nothing

I have some files each day that I want to be attached to this email. They have a date in the file name. Example: "very secret-Nov-02 stuff.pdf" The date will always be yesterday's date, so tomorrow "Nov-03" will be in the file name. I need some code that will identify any file that has yesterday's date. I can read code and generally understand what it does, but I cannot write it. (Not yet, at least) I could use anyone's help that is willing, and I could learn a little bit in the process.
 
This issue is solved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top