Not sure I follow you, I took your code from post # 10 and added the code to loop through all accounts and send using one of the two you mention. If both are available on one specific computer it will use the one that comes first in the loop.
If you only have two computers then you can use a simple If statement to select which account to use:
Code:
If Environ$("computername")="Computer1" Then
.SentOnBehalfOfName = "info1@testing.com"
Else
.SentOnBehalfOfName = "info2@testing.com"
End If
I tried your code... Seems to work but every other time I click the button, I get this error?
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Dim oAccount As Outlook.Account
Set appOutLook = CreateObject("Outlook.Application")
For Each oAccount In appOutLook.Session.Accounts
If oAccount = "results@testing.com" Or oAccount = "results1@testing.com" Then
Set MailOutLook = CreateItem(olMailItem)
MailOutLook.SendUsingAccount = oAccount
End If
Next
Set MailOutLook = CreateItem(olMailItem) is where it turns yellow. I think it might have something to do with Outlook not being opened first?
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Dim oAccount As Outlook.Account
Set appOutLook = CreateObject("Outlook.Application")
For Each oAccount In appOutLook.Session.Accounts
If oAccount = "results@testing.com" Or oAccount = "results1@testing.com" Then Set MailOutLook = CreateItem(olMailItem)
MailOutLook.SendUsingAccount = oAccount
End If
Next