Inserting sender name and address with vba

Status
Not open for further replies.

Dean Waring

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I am trying to create emails using vba. I get the email created with the To:, Subject:, Body:, and attachments just fine but none of the examples that I've searched and researched seem to show the sender's name, address, phone or anything like that. For instance:

Public Sub sendmeTest()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim obj As Outlook.MailItem

Set objOutlook = GetObject(, "Outlook.Application")

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("John.Smith@td.com")

objOutlookRecip.Type = olTo
.Subject = "Monthly Reports"
.Body = "Attached are this month's monthly reports. Let me know if you have any questions."
.CC = "Allison.Jones@td.com"
.Importance = olImportanceNormal
DisplayCurrentUser


' .Send
.Display
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Exit Sub
End Sub

This creates the email very nicely, but doesn't have sender details. Any thoughts?
 
Status
Not open for further replies.
Top