I discovered that I did not have the proper object library. So for early binding, I have the following code:
This fails on "Set olAccount = oLook.account" with the error "object doesn't support this property or method". What I am doing wrong?
Sub doEmailOutlook() Dim oLook As Object Dim oMail As Outlook.MailItem Dim olAccount As Variant Dim olAccounts As Variant Set oLook = CreateObject("Outlook.Application") Set oMail = oLook.CreateItem(0) Set olAccount = oLook.account Set olAccounts = oLook.application.Session.accounts Set olAccountTemp = oLook.account Dim strEmail As String Dim strMsg As String Dim foundAccount As Boolean Dim strFrom As String foundAccount = False strFrom = "[EMAIL="firstname.lastname@example.org"]email@example.com[/EMAIL]" Set olAccounts = oLook.application.Session.accounts For Each olAccountTemp In olAccounts If (olAccountTemp.smtpAddress = strFrom) Then Set olAccount = olAccountTemp foundAccount = True Debug.Print olAccountTemp.smtpAddress Exit For End If Next