scripting message with attachment

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
 
A

ac2006

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top