Code to add attachment

L

Lynda

Hi Everybody, I am probably stretching the friendship here but I thought I
would ask anyway. I have created a form in excel 2003 with the submit button
to send by email. What I want to know is is it possible to have another
button on the form to add an attachment and then hit the submit button and
have both the form and attachment sent by email.
Thanks in advance for any assistance.

Lynda
 
S

sbitaxi

Hi Everybody, I am probably stretching the friendship here but I thought I
would ask anyway. I have created a form in excel 2003 with the submit button
to send by email. What I want to know is is it possible to have another
button on the form to add an attachment and then hit the submit button and
have both the form and attachment sent by email.
Thanks in advance for any assistance.

Lynda

Hi Lynda:

You can try playing with this code, I use it for a script to filter
data into multiple workbooks and attach them to email messages. Note -
you cannot have a signature and provide text for the body of the email
programmatically (at least, I have never been successful doing so), it
is one or the other.


Steven

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = "RecipientAddress"
.CC = "CarbonCopyAddress"
.BCC = "BlindCarbonCopyAddress"
.Subject = "Your subject here"
.Attachments.Add ActiveWorkbook.FullName
'Attaches active workbook
.Display 'Displays the processed email. You
can change this to .Send
End With
On Error GoTo 0
 

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