Not a Member Yet,
Click here to Register
How do you like the new design?

ID: 415
Viewed: 2985
Added: Aug 19, 2002
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Send a Message with VB and Outlook

Highlight all by clicking in box

Highlight All
Sub SendMessage(DisplayMsg As Boolean, Receiver As String, Optional
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim CallDescription As String

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(Receiver)
objOutlookRecip.Type = olTo

' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("an other person")
objOutlookRecip.Type = olCC

' Add the BCC recipient(s) to the message.
' Set objOutlookRecip = .Recipients.Add("Andrew Fuller")
' objOutlookRecip.Type = olBCC

' Add the From recipient(s) to the message.
' objOutlookMsg.SentOnBehalfOfName = "Me Myself and I"

' Set the Subject, Body, and Importance of the message.
.Subject = "Replace this String With your subject Or variabele"

.Body = "replace this String With your subject Or variabele"
.Body = .Body & vbCrLf & "In this manner you can create a body larger than 256 characters"

'.Importance = olImportanceHigh 'High importance

' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients

' Should we display the message before sending?
If DisplayMsg Then
End If

End With

Set objOutlook = Nothing
End Sub;

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2018 All Rights Reserved. Conditions