Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Attach file to e-mail using excel macro

Thanks for the help. This was what I was looking for. However if I execute
this code multiple times it is almost as if the file to be attached is saved
to a clipboard. Each subsequent time I execute the code the previously
attached file is also added. i.e. If I run the code a second time it not
only attaches the file selected by the code but also the file selected by the
code when run previously. Is there a way to "clear" the clipboard so only
the one file is attached?

"arjen van..." wrote:

Try something like this:

Sub NewMail()

ActiveWorkbook.EnvelopeVisible = True

Dim strAttachment As String
strAttachment = "C:\customers.txt"

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

End Sub

Though I think creating the string variable isn't essential, you could just
put the path directly after .Add

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
How can you attach an e-mail into an excel worksheet? humdul Excel Worksheet Functions 1 January 7th 10 05:23 PM
Mail worksheet in Body AND Attach File BenS Excel Programming 3 January 21st 09 06:11 PM
e-Mail File out of Excel 2003 Macro Marvin Excel Programming 3 December 28th 06 05:08 AM
E-mail macro - how do I attach multiple attachments? G and (ajk) Excel Discussion (Misc queries) 1 October 9th 06 01:22 PM
How do I attach an excel document to a word one for mail merge? Ruth Excel Discussion (Misc queries) 1 January 6th 06 10:29 PM


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

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

About Us

"It's about Microsoft Excel"