View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Karim Benabd Karim Benabd is offline
external usenet poster
 
Posts: 25
Default Attach Open Excel Spreadshee to Email

Try:

Add a reference to Microsoft Outlook in VBE (Tools References).

Add this function to a module

Function msgA(mySubject, myBody, myTo, myCC, myAttachment)
Dim OutlookApp As Object
Const olMailItem = 0

Set OutlookApp = CreateObject("Outlook.Application")
With OutlookApp.CreateItem(olMailItem)
.Subject = mySubject
.Body = myBody
.To = myTo
.cc = myCC
.Attachments.Add myAttachment
.Send
End With
Set OutlookApp = Nothing
End Function

In your userform, add a button and in the click event add the following
lines:
Subject = "Test"
Body = "Attached Excel file"
A = "
CC = "

msgA Subject, Body, A, CC, ActiveWorkbook.FullName

This is working for me with Excel 2000 pro.

NB. The code snippet is not mine. But I do not remember where I picked
from Internet.

I hope this helps.

Regards,
Karim