PDA

View Full Version : Help Send an Email to Outlook Group in VBA



francozola25
05-08-2008, 04:52 AM
Hi i am wondering if someone could help me

I am currently working on a VBA application, the main thing it does in when a document is opened, a button is click and the macro will run; what happens is it that the name of the doc i have opened (WordFN), searches this in excel, once found offsets to the right take this value (ExcelFN) and opens it as a word document.

What i want to do is when is for the macro to send an email to a group in Outlook.

Is this possible to do?

Jacob Hilderbrand
06-06-2008, 12:23 PM
Try this:


Option Explicit

Sub eMail()

Dim OL As Object
Dim EmailItem As Object
Dim Doc As Document

Application.ScreenUpdating = False

Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument

With EmailItem
.Subject = "Insert Subject Here"
.Body = "Insert message here" & vbCrLf & _
"Line 2" & vbCrLf & _
"Line 3"
.To = "User@Domain.Com"
.Display
End With

Application.ScreenUpdating = True

Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing

End Sub