LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default code to attach files

Thanks, Chad, it was a great help for me!
Stefi


Chad ezt *rta:

here's a portion of the code i use:

'You must add a reference to the Microsoft outlook Library

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
Dim strbody As String

strbody = "Email body text"

With OutMail
.To = "
'.CC = ""
'.BCC = ""
subjectline = "test email
.Subject = subjectline
.Body = strbody
.Importance = olImportanceHigh
.ReadReceiptRequested = True
'define attachment
attachmentname = "c:\" 'adjust to your directory
Set myAttachments = OutMail.Attachments
myAttachments.Add attachmentname
.Send 'or use .Display to display the message prior to sending

End With

hope this helps,
-chad


"Stefi" wrote:

Hi Chad,

Could you share with me the code or the concept of sending an e-mail WITH
SPECIFIC FILES ATTACHED through VBA?

Thanks in advance!
Stefi


Chad ezt *rta:

I have code that generates an email and attaches specific files. I would
like to know if there is VBA code to be able to attach ALL files within a
specific folder, not just one specific file. Kind of like a "select all"
within a folder that attaches all selected items to an email. Any thoughts?
Thanks in advance.

-Chad

 
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
attach files ankurcma Excel Worksheet Functions 2 January 8th 10 02:10 PM
Attach code MAX Excel Worksheet Functions 5 March 16th 09 11:11 PM
Enable postings to attach files in question ILoveMyCorgi Charts and Charting in Excel 1 October 13th 08 09:39 PM
attach files Mark V Excel Worksheet Functions 1 March 8th 07 03:42 AM
I want to attach word files or PDF files to an excel database Dianne Munro Excel Discussion (Misc queries) 1 March 23rd 06 12:11 AM


All times are GMT +1. The time now is 08:23 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"