View Single Post
  #2  
Old November 19th 07, 06:31 PM posted to microsoft.public.outlook.program_vba
JP[_2_]
external usenet poster
 
Posts: 18
Default Automating Outlook from within Access

Check out the ".SentOnBehalfOfName" property -- you can use it to
specify a sender


HTH,
JP




On Nov 19, 11:30 am, Tylendal
wrote:
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


Ads