pdering
asked on
How do I change the From field when sending an Outlook message from Access?
I have multiple POP accounts in Outlook (under a single profile). How do I send an Outlook message and change the from field from Access.
Here is the code I'm trying to use...
Set ola1 = New Outlook.Application
Dim oAccount As Outlook.Account
For Each oAccount In ola1.Session.Accounts
MsgBox oAccount.DisplayName
If oAccount.AccountType = olPop3 Then
If oAccount.DisplayName = "john@smith.com" Then
'We found the correct Account
Exit For
End If
End If
Next
Set m = ola1.CreateItem(olMailItem )
m.SendUsingAccount = oAccount
m.Subject = "subject here"
If bolHTML = True Then
m.HTMLBody = "hello1"
Else
m.Body = "hello2"
End If
m.Display
Here is the code I'm trying to use...
Set ola1 = New Outlook.Application
Dim oAccount As Outlook.Account
For Each oAccount In ola1.Session.Accounts
MsgBox oAccount.DisplayName
If oAccount.AccountType = olPop3 Then
If oAccount.DisplayName = "john@smith.com" Then
'We found the correct Account
Exit For
End If
End If
Next
Set m = ola1.CreateItem(olMailItem
m.SendUsingAccount = oAccount
m.Subject = "subject here"
If bolHTML = True Then
m.HTMLBody = "hello1"
Else
m.Body = "hello2"
End If
m.Display
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.