• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

MsgBox when not sending from specified account

Mister-B

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Exchange Server
#1
Hi there,

in my company we have Outlook 2016 on an Exchange server. I have several accounts that I see when I open Outlook. The problem I have is that I often forget to set the "From" tab when I am writing Mails. This means that I very often send them from my own account, which is the default, instead of from the account that I should be using. Is it possible for VBA code to send out a Message if a particular account is not selected in "From"? This code should be activated when I hit the "Send" button.

Regards,
Martin
 
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
#2
I have this macro - Warn Before Sending Messages to the Wrong Email Address

I use a version of it myself - i only check messages sent to one specific domain that has restrictions on the addresses that can send to it. Since only one of my accounts is allowed, I stop the send if the wrong account is sending.
 

Mister-B

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Exchange Server
#3
Hi Diane,

thanks for pointing me in the right direction. Funnily "Item.SendUsingAccount" didn't work for me. I got around it by using the "Item.SendOfBehalfname". This is my Code and it works fine:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If Item.SentOnBehalfOfName = "Fortbildung (xxxxxxx)" Then Exit Sub
If MsgBox("Have you selected the correct account?", vbYesNo, "My Company") <> vbYes Then
Cancel = True
End If
End Sub

Kind regards,
Martin
 

Similar threads