Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Sub SendMessage(DisplayMsg As Boolean, Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
'Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
'Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add
objOutlookRecip.Type = olTo
.Subject = "This an Automation test with Microsoft Outlook, VBA and Access"
.BODY = "Please RSVP at your convenience
.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
'objOutlookRecip.Resolve
'Next
'Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.Save
.Send
End If
End With
rst.MoveNext
Loop
Set objOutlook = Nothing
End Sub