SendFromAccount - Problem trying to test existing value in open email

Status
Not open for further replies.

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!
 
Hi Again,

Perseverance finally paid off!

If InStr(LCase(objMail.SendUsingAccount), "fred.bloggs@outlook.com") Then

After eventually stumbling on the correct search terms to use in my browser, it led me to another post on the web that shows you how to prompt a user as to whether or not they've really specified the intended 'From' value in their email, just before sending it. The post included the example line above (or very similar), which does exactly what I needed!

Sorry to having caused a false alarm here, but I'd been struggling for ages on that particular challenge, before I finally posted the above plea for help.

Kind regards,

Steve
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
R Imap read/unread problem Using Outlook 3
Victor_50 Problem - Google Workspace will stop "unsafe" access to Outlook end 2024 Using Outlook 3
A Online Mode to Cached Exchange Mode problem Using Outlook 2
S Problem Accessing .MSG Property 'ImageNaturalHeight' Tag '0x80010003' Outlook VBA and Custom Forms 1
T Problem when requesting to view an email in a browser Using Outlook 0
R Outlook 2021 Having problem setting up outlook 2021 with windows 11. I have 3 gmail accounts and I want the 3 gmail, emails to merge into the same outlook input. Using Outlook.com accounts in Outlook 0
e_a_g_l_e_p_i Is anyone else having problem conneccting to gmail? Using Outlook 27
P Outlook calendar and contacts sync problem-outlook disconnects Using Outlook.com accounts in Outlook 2
S Archiving and Likely Modified Date Problem Using Outlook 3
R Problem moving file “Email folders.pst” to new PC Using Outlook 5
S Problem Checking the available stores in my Inbox (Outlook VBA) Outlook VBA and Custom Forms 0
Witzker GetAssignedView Problem Outlook VBA and Custom Forms 2
M Outlook 2010 Problem with OutLook 2010 32 bit, after Windows Auto Update Using Outlook 3
Marc2019 Outlook 2016 Font Problem Using Outlook 5
X I have met my waterloo trying to resolve embedded graphics problem with outlook 2007 and now 2016 Using Outlook 1
D Problem with custom form including _DocSiteControl1 Outlook VBA and Custom Forms 0
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 4
S Outlook 2007 Calendar instant search problem. Windows 7 Using Outlook 0
D Sort Problem with Sent Folders Using Outlook 1
S Conditional formatting problem with "is not empty" and categories Using Outlook 2
Mark Foley The upload of "Calendar" failed. There was a problem with the request. Using Outlook 6
avant-guvnor Import csv problem Using Outlook 7
katehawkins Outlook 2013 Ost to pst conversion problem Using Outlook 1
AbbieWhite The problem with a fairly large file. Using Outlook 3
I Outlook 2013 Send problem - 'Not Responding' forever Using Outlook.com accounts in Outlook 10
EmelineGueguen Help to understand the problem of work Using Outlook 1
W Outlook 2016 search problem persists after applying all known solutions Using Outlook 12
S problem with convert Using Outlook 1
DruinaBiscardi unexpected problem in outlook Using Outlook 1
V Outlook 2003 problem with Windows 10 Creators Update 1709 Using Outlook 0
G Windows Update Causes BCM Database Access Problem? BCM (Business Contact Manager) 4
Grimev66 problem with conversion ost to pst Using Outlook 2
R Problem with searching public folders Exchange 2013/16 Exchange Server Administration 2
J Problem with Outlook 2016 new mail tray icon alert (envelope in the systems tray) Using Outlook.com accounts in Outlook 0
S Problem running Command button code Outlook VBA and Custom Forms 2
A .ost file problem Using Outlook 4
G PROBLEM REGARDING OUTLOOK STORAGE LANGUAGES Using Outlook 4
PetraTech Odd Folder View Problem Using Outlook 3
V iCloud problem Using Outlook 9
D Reply Problem with Outlook.com account Using Outlook.com accounts in Outlook 0
MattC Problem with Outlook 2007 & iCloud / duplicate tasks Using Outlook 1
V Problem moving folders Using Outlook 4
C Problem tracking meeting responses Using Outlook 3
Mark Foley Problem subscribing to shared calendar Using Outlook 1
K Problem with FreeBusy (before 1pm only) Outlook VBA and Custom Forms 7
skylark53 Advanced recurrence problem Using Outlook 2
E RSS export as OPML problem Using Outlook 4
D outlook 2013 contact list problem Using Outlook 0
T Problem with .Recipients.Add("alias") Outlook VBA and Custom Forms 3
P Problem with Outlook 2013 Attachments Using Outlook 4

Similar threads

Back
Top