Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Code to add attachment

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Code to add attachment

On Sep 18, 6:34*am, Lynda 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Code to add attachment

Thank you Steven, that was what i was looking for.

" wrote:

On Sep 18, 6:34 am, Lynda 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
remove vba code before emailing as attachment pswanie Excel Programming 1 March 12th 08 10:37 PM
email as attachment in code hommer Excel Programming 2 March 15th 06 03:00 PM
VB code to generate an e-mail with an EXCEL attachment, but not se MJ Excel Programming 5 March 17th 05 07:10 PM
CODE FOR CHECK BOXES, AND EXCEL AS ATTACHMENT ! jay dean Excel Programming 3 May 26th 04 09:22 PM


All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"