Steve Tomalin
Member
- Outlook version
- Outlook 2016 32 bit
- Email Account
- Outlook.com (as MS Exchange)
Hi all,
Whilst I've had a certain degree of success in using the MailItem.SendUsingAccount property to set the Outlook account through which I want to send an email, I've hit a brick wall in my attempts to use the MailItem.SendUsingAccount property to retreive this value from the current, open item. The Microsoft Office VBA Reference seems to suggest this should be possible, i.e.:
"Returns or sets an Account object that represents the account under which the MailItem is to be sent. Read/write."
I have a few different email accounts set up in my Outlook environment, including a couple of Exchange accounts which do not require any intervention. However, in the case of the two Outlook.com accounts I use in Outlook, I want to automatically change the SendUsingAccount value, dependant upon the existing value of the SentUsingAccount within each of the emails I work on. So, as a generic example (and not in true VBA speak):
If current SendUsingAccount of objMail = "Fred.Bloggs@Outlook.com" Then
Set SendUsingAccount = "Fred.Bloggs@TestDomain.com"
ElseIf current SendUsingAccount of objMail = Fred.BloggsOther@Outlook.com" Then
Set SendUsingAccount = "Fred.Bloggs@OtherTestDomain.com"
EndIf
So, my problem is, how do I get the current value of SendUsingAccount within the open email and then, say, display it within a MsgBox?
If somebody could show me how to do this one thing, then I think I can probably do the rest for myself.
I realise that my use of my Outlook.com accounts might appear a little strange to some, but I have my reasons for this, it works well for me and I dont want really to change it. Currently, whenever I create a new email, or perform a reply or replyall or forward to an existing email, I have to remember to check/change the 'From' dropdown to the appropriate value. I just want to automate this repetative, manual step.
Any assistance in solving my VBA macro problem here would be very much appreciated.
Kind regards,
Steve
P.S. I'm not really a developer, so please be gentle with me!
Whilst I've had a certain degree of success in using the MailItem.SendUsingAccount property to set the Outlook account through which I want to send an email, I've hit a brick wall in my attempts to use the MailItem.SendUsingAccount property to retreive this value from the current, open item. The Microsoft Office VBA Reference seems to suggest this should be possible, i.e.:
"Returns or sets an Account object that represents the account under which the MailItem is to be sent. Read/write."
I have a few different email accounts set up in my Outlook environment, including a couple of Exchange accounts which do not require any intervention. However, in the case of the two Outlook.com accounts I use in Outlook, I want to automatically change the SendUsingAccount value, dependant upon the existing value of the SentUsingAccount within each of the emails I work on. So, as a generic example (and not in true VBA speak):
If current SendUsingAccount of objMail = "Fred.Bloggs@Outlook.com" Then
Set SendUsingAccount = "Fred.Bloggs@TestDomain.com"
ElseIf current SendUsingAccount of objMail = Fred.BloggsOther@Outlook.com" Then
Set SendUsingAccount = "Fred.Bloggs@OtherTestDomain.com"
EndIf
So, my problem is, how do I get the current value of SendUsingAccount within the open email and then, say, display it within a MsgBox?
If somebody could show me how to do this one thing, then I think I can probably do the rest for myself.
I realise that my use of my Outlook.com accounts might appear a little strange to some, but I have my reasons for this, it works well for me and I dont want really to change it. Currently, whenever I create a new email, or perform a reply or replyall or forward to an existing email, I have to remember to check/change the 'From' dropdown to the appropriate value. I just want to automate this repetative, manual step.
Any assistance in solving my VBA macro problem here would be very much appreciated.
Kind regards,
Steve
P.S. I'm not really a developer, so please be gentle with me!