scripting message with attachment

  • Thread starter Thread starter ac2006
  • Start date Start date
A

ac2006

Hello,

I'd like to script sending a message with an attachment. I've found how to
do this when you know the attachment's name. But I need to script adding an
attachment when I don't know it's name.

The file I want to attach will always be located in C:\Reports and will
always be a PDF, but the name will change every day. I tried ATT =
"C:\Reports\*.pdf" but that didn't work.

I copied this script from a site and modified it for my needs, I really
don't know anything about scripting. Any help would be appreciated. Thank
you.

RCP = "(e-mail address removed)"
MSG = "Test message"
SUBJ = "Test subject"
ATT = "C:\Reports\Attachment.pdf"

Set Outlook = CreateObject("Outlook.Application")
Set MAPI = Outlook.GetNameSpace("MAPI")
Set NewMail = Outlook.CreateItem(0)
NewMail.Subject = SUBJ
NewMail.Body = MSG
NewMail.Recipients.Add RCP
NewMail.Attachments.Add ATT

NewMail.Send
 
Hi Sue,

Thank you for your response. However, the link you provided takes me to two
redirect pages and at the final page it crashes out both I.E. and Firefox.

Do you happen to have another link with the same info?

--Ali
 
Back
Top