PC Review


Reply
Thread Tools Rate Thread

Code to add attachment

 
 
Lynda
Guest
Posts: n/a
 
      18th Sep 2008
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
 
Reply With Quote
 
 
 
 
sbitaxi@gmail.com
Guest
Posts: n/a
 
      18th Sep 2008
On Sep 18, 6:34*am, Lynda <Ly...@discussions.microsoft.com> wrote:
> 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

 
Reply With Quote
 
Lynda
Guest
Posts: n/a
 
      19th Sep 2008
Thank you Steven, that was what i was looking for.

"(E-Mail Removed)" wrote:

> On Sep 18, 6:34 am, Lynda <Ly...@discussions.microsoft.com> wrote:
> > 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
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Code For Outlook Attachment arnold Microsoft Access 4 3rd Apr 2008 02:58 PM
Print Attachment Code =?Utf-8?B?VG9kZA==?= Microsoft Outlook Discussion 1 19th Apr 2006 08:11 PM
Save Attachment through VB code =?Utf-8?B?Sko=?= Microsoft Outlook VBA Programming 3 14th Dec 2004 12:48 AM
VBA code for moving attachment R. Elorza Microsoft Outlook VBA Programming 4 23rd Feb 2004 06:16 AM
Open Attachment with Code Tobias Ortmann Microsoft Outlook Form Programming 3 1st Jul 2003 10:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:11 PM.