Thread: E-mail macro
View Single Post
  #2   Report Post  
Chad
 
Posts: n/a
Default

Here's how to send a workbook from Excel as an attachment:

Create a macro with the code below and then create a button that calls that
macro. Keep in mind you must add a reference to the Microsoft outlook
Library (Tools\References).

'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 = "here is the workbook"
With OutMail
.To = " 'or whatever your recipients name
'.CC = "" 'if any
'.BCC = 'if any
.Subject = "here"
.Body = strbody
'define attachment
attachmentname = "C:\Documents and Settings\All
Users\Desktop\Book1.xls" 'your path
Set myAttachments = OutMail.Attachments
myAttachments.Add attachmentname
.Display 'or use .Send to bypass the display
End With

Hope this helps!
-Chad

"greg7468" wrote:


Hi all,
I have a workbook that I send out daily to a contact list within
outlook.

What is the best way of doing this with a macro to work off a button on
the worksheet.

Thanks in advance.


--
greg7468


------------------------------------------------------------------------
greg7468's Profile: http://www.excelforum.com/member.php...fo&userid=9031
View this thread: http://www.excelforum.com/showthread...hreadid=469881