G
Guest
Im attempting to automate and Outlook Email send from within an Access
application. This is the code I'm using.
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim mMgrAddy As String
Dim mEmpAddy As String
mBody = "This is test of the olOriginator MailItem"
' 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(mEmpAddy)
objOutlookRecip.Type = olTo
' Add the From recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(mMgrAddy)
objOutlookRecip.Type = olBCC
' Set the Subject, Body, and Importance of the message.
.Subject = "This is a TEST Email"
.Body = mBody & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' 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
My question has to do with the "From" button which opens Choose Sender when
working directly in Outlook. The person running the Access application has
rights to a specific email addy they can use but I cant seem to figure out
how to make the application use the "From" or Choose Sender Outlook feature.
Appreciate any assistance on this.
Thanks
Fred Alyea
application. This is the code I'm using.
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim mMgrAddy As String
Dim mEmpAddy As String
mBody = "This is test of the olOriginator MailItem"
' 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(mEmpAddy)
objOutlookRecip.Type = olTo
' Add the From recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(mMgrAddy)
objOutlookRecip.Type = olBCC
' Set the Subject, Body, and Importance of the message.
.Subject = "This is a TEST Email"
.Body = mBody & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' 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
My question has to do with the "From" button which opens Choose Sender when
working directly in Outlook. The person running the Access application has
rights to a specific email addy they can use but I cant seem to figure out
how to make the application use the "From" or Choose Sender Outlook feature.
Appreciate any assistance on this.
Thanks
Fred Alyea