Excel VBA Excel 2007 - Attaching File to E-mail using a Macro

Joined
Jul 27, 2009
Messages
1
Reaction score
0
I wrote a Macro in Excel that will open an e-mail and send it using the following code.

ActiveWorkbook.EnvelopeVisible = True

With ActiveSheet.MailEnvelope
.Introduction = Range("T22")
.Item.To = Range("T15")
.Item.CC = Range("T16")
.Item.Subject = "CST CARRIERS"
.Item.Send
End With

I want to attach a file to this e-mail before sending but don't know the syntax to do this. I know exactly where the file will be stored as well as the file name. Does anyone know the syntax for performing the attachment of the file?


I know you can attach files to these e-mails because if you insert a "Stop" statement just Prior to the ".Item.Send" statement and run the macro you can see and manually send the e-mail. There is an attachment button on the e-mail that I have successfully used to manually attach the file prior to sending the e-mail. I tried recording a macro to get at the code but it didn't copy anything while I performed the manual steps.
 
Last edited:

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