Auto name checking upon Tab or Click off To field(s)

Status
Not open for further replies.

Brian Lain

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
We have some users with itchy clicker fingers who love to hit Send without completing To addresses. I’ve enabled “Automatic name checking” in Group Policy, but all that does it put a squiggly red line beneath the still incomplete address (if it’s non-unique). I realize they get prompted to Check Names when they hit Send, but apparently those itchy clicker fingers love to double click random names (gotta love those PEBCAK errors).

My question is, is there a way to invoke a “Check Names” prompt auto/programmatically when tabbing from, or clicking off, the To/Cc fields (prior to hitting Send)?
 
It's easier to auto check when the Send button is hit, then cancel if a name cannot be resolved. Just keep in mind that even nonsense is resolved as long as it looks like a valid email address.
Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  if item.recipients.resolveall=false then
    cancel=true
  endif
End Sub
 
Names autoresolve against contacts (and properly formatted addresses resolve) when you tab out of the fields but the dialog only comes up if they don't take the steps to fix unresolved entries before sending.
 
It's easier to auto check when the Send button is hit, then cancel if a name cannot be resolved. Just keep in mind that even nonsense is resolved as long as it looks like a valid email address.
Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  if item.recipients.resolveall=false then
    cancel=true
  endif
End Sub

Where would I implement this code snippet? (Sorry, not a macro/VBA guy.)
[DOUBLEPOST=1440688654][/DOUBLEPOST]
Names autoresolve against contacts (and properly formatted addresses resolve) when you tab out of the fields but the dialog only comes up if they don't take the steps to fix unresolved entries before sending.

Right. I'm just looking for a way to force a Check Names prior to hitting Send.
 
Michael - what about triggering a macro as they tab out of the fields - maybe a dialog box that says there are unresolvable addresses that need fixed?
 
There's no event that triggers when you tab out. You could use the PropertyChange event, which is quite complicated to use for addresses. Thus I mentioned the ItemSend event. It should sufficiently do the trick: do not send if there's an unresolved address.
 
Ah, thanks. That's why you are the code guru. :)
 
There's no event that triggers when you tab out. You could use the PropertyChange event, which is quite complicated to use for addresses. Thus I mentioned the ItemSend event. It should sufficiently do the trick: do not send if there's an unresolved address.

Just to clarify, how does the Send process get modified in this instance? User hits Send, Check Names pops up as usual due to an unresolved address, user selects address from list....then what? Are they returned to the composition window until they hit Send again?
 
Hmmm. Resolve is triggered before item send - so the macro doesn't really add any benefit as outlook won't attempt to send bad addresses until they are resolved. You want to jump in before the resolve dialog comes up or cancels resolve and throws it back to the message.
 
Sure, Outlook wouldn' send anyway. The problem actually is: If users don't look at what they click on, there's nothign you can do to prevent it.

There's the BeforeCheckNames event, I just don't see how it could be helpful in this case.
 
What about the trigger that causes the red underlines? Is there a way to hook into that? Or would that also hook into spell check as well?
 
Taking a different approach, what about changing the button layout for new messages? As a test, I've customized the ribbon to display Send and Check Names buttons on the far left (right above the actual Send button). And I've figured out how to "design this form" via the Developer menu, but I see no option to remove the Send button from the form (or to add a Check Names button right next to it). If we could do that, then the new layout plus a little user re-training could go a long way toward resolving the issue. Thoughts?
 
What about the trigger that causes the red underlines?
The only event is the BeforeCheckNames event. Depending on the outcome, Outlook will underline the address in red or in black. There's no event to tell you that CheckNames has finished and is going to prompt the user.

What do you really want to achieve? If you don't get the users now to select the names they really want to send to, how would a CheckNames button change that? BTW pressing alt+k would also call the CheckNames function.

As the user could also pick a wrong name in the first place, you could always ask before sending 'Are you sure recipient x is the one you want?'. These users will treat that prompt as they always do, they'll click OK without checking if it's really ok. So you'll end up moving in a circle.
 
Thanks for your help Michael and Diane. We've decided to scrap the custom form/programmatic solution for now. We're going with a 3 pronged approach: 1-Enable Auto-resolve, 2-Enable Delayed Send, and 3-User policy.

So on the delayed send piece (2), I know how to create a rule to do that with all outgoing email (thanks to one of Diane's previous forum posts). And I can export that rule to an RWZ file, and manually import it. The question now is if there is a way to either import the RWZ file via script, or just create the new rule via script?
 
Just wanted to chime in one last time to thank you both again for your patience and assistance on this, and to update you on what we finally implemented for the delayed send piece.

So we ended up creating a macro (with help from one of Diane's how-to's) to modify the Send process itself (see code below). If the subject line contains the word "immediate" then Send proceeds as usual, if not it defers delivery for 5 minutes from now. That gives users enough time to grab it in their Outbox and make any needed corrections or changes

The odd thing about deploying this is that it appears as if the code needs to be viewed (Alt+F11) to be activated. Does that make sense to you? Any way around that?

Code:
Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  Dim objMailItem As MailItem       ' to hold mail item
  Dim intErrNumber As Integer
  '
  On Error GoTo Err_Handler         'Error Handling
  Set objMailItem = Item            'Set object to mail item just sent
  'If objMailItem.Subject <> "Immediate" Then
  If InStr(1, objMailItem.Subject, "Immediate", vbTextCompare) = 0 Then
    objMailItem.DeferredDeliveryTime = DateAdd("n", 5, Now)     'Delay is + 2 minutes
   End If
  Exit Sub
Err_Handler:
'Due to lack of concentration of the code writing genius there has been a bit of an error,
'  lets tell someone about it by popping up a message box with a detailed description on the screen.
  intErrNumber = Err.Number
  If intErrNumber = 13 Then
   'Nothing.
  Else
    MsgBox ("An error has occured on line " & Erl & ", with a description: " & Err.Description & ", and an error number " & _
       Err.Number)
  End If
End Sub
 
Correct, if you deploy code, users will need to open the editor to enable it. There is no way around it, should of compiling an addin instead of using a macro.
 
Correct, if you deploy code, users will need to open the editor to enable it. There is no way around it, should of compiling an addin instead of using a macro.
What would be the easiest way to compile it into an add-in? Visual Studio? Would that add-in then be deploy-able (MSI, EXE, etc.)?
 
Visual studio and yes, you can deploy it automatically.
 
Sorry to resurrect what seemed like a closed case, but we're receiving some push back from users (careful what they wish for) regarding the new send delay. I'm wondering if there's a way to set the DeferDelivery time to say 5 seconds if the user checks a box in a custom message form. Then rework the script to not overwrite any non-default delay (so the above override, plus say a compose Sat/send Mon type scenario as well). The scripting logic seems like the easy part, whereas tying it to a user selection seems much more involved. Any thoughts?
 
Hi Brian,

As an alternative to a delay, you could look into using various add-ins for preventing accidental emails being sent. "Safeguard Send" and "SafeSend" are a few that do this in various forms, they might help you.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Outlook Rules - Changing auto-submit address in multiple rules, according to rule name Outlook VBA and Custom Forms 0
C Auto subject,name,email,deferred Using Outlook 2
P Email address auto-completes work fine on laptop, but no longer on desktop Using Outlook 2
C New pc, new outlook, is it possible to import auto-complete emailaddress Using Outlook 4
R Outlook 365 VBA AUTO SEND WITH DELAY FOR EACH EMAIL Outlook VBA and Custom Forms 0
Nufc1980 Outlook "Please treat this as private label" auto added to some emails - Help. Using Outlook 3
K vba code to auto download email into a specific folder in local hard disk as and when any new email arrives in Inbox/subfolder Outlook VBA and Custom Forms 0
F Auto changing email subject line in bulk Using Outlook 2
T Outlook 2019 Not Using Auto Compete After Deletion of 365 Using Outlook 1
richardwing Auto forward email that is moves into a specific outlook folder Outlook VBA and Custom Forms 5
D Auto Remove [EXTERNAL] from subject - Issue with Macro Using Outlook 21
nmanikrishnan Auto-reply from default account Using Outlook 1
A Imap account not auto syncing inbox at startup Using Outlook 0
K Run a script rule to auto 'send again' on undeliverable emails? Outlook VBA and Custom Forms 1
FryW Need help modifying a VBA script for in coming emails to auto set custom reminder time Outlook VBA and Custom Forms 0
S Auto forward for multiple emails Outlook VBA and Custom Forms 0
DDB VBA to Auto Insert Date and Time in the signature Outlook VBA and Custom Forms 2
V Auto-complete stopped working Using Outlook 4
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
M Replyall macro with template and auto insert receptens Outlook VBA and Custom Forms 1
R Auto Forwarding with different "From" Outlook VBA and Custom Forms 0
P auto-complete is hopelessly broken Using Outlook 0
R Auto Assign Category colours to Incoming Emails based on whom the email is addressed Outlook VBA and Custom Forms 3
C Auto Run VBA Code on new email Outlook VBA and Custom Forms 1
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
V Auto-Submitted: auto-replied in header Using Outlook 0
R Auto display of new email does not work on non-default account Outlook VBA and Custom Forms 0
B Outlook 2016 Auto-archive creates new folder Using Outlook 3
J Edit auto-complete list in Outlook 2016+/365? Using Outlook 0
P Auto assign shared mailbox Outlook VBA and Custom Forms 1
M Outlook 2010 Problem with OutLook 2010 32 bit, after Windows Auto Update Using Outlook 3
P [SOLVED] Auto remove [EXTERNAL] from subject Using Outlook 16
Z Add text to auto-forwarded e-mail Outlook VBA and Custom Forms 4
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
Q Prompt button to auto turn on Out of Office Outlook VBA and Custom Forms 3
P Auto Insert Current Date or Time into Email Subject Outlook VBA and Custom Forms 2
S Messages moved / deleted by auto-archive are not synchronized to exchange Exchange Server Administration 8
B Outlook 2010 is Auto Purging when not configured for that Using Outlook 1
M VBA to auto forward message with new subject and body text Outlook VBA and Custom Forms 8
A Auto Accept Meetings from the General Calendar Using Outlook 3
R auto send email when meeting closes from a shared calendar only Outlook VBA and Custom Forms 2
S auto-mapping mailboxes in outlook impacting an ost file? Exchange Server Administration 2
M Auto expand Distribution List Before Sending Email Outlook VBA and Custom Forms 1
M Auto-export mail to Excel Outlook VBA and Custom Forms 2
Ms_Cynic Auto-pasting email content in calendar appt? Using Outlook 2
R How Do I insert images in and Auto Reply Using Outlook 3
S Received mail as part of DL, need to auto-CC the same when replying Outlook VBA and Custom Forms 5
T Have Outlook 2016 suggest email address auto complete entries directly from the user's contacts list Using Outlook 10
T Have Outlook 2016 suggest email address auto complete entries directly from the user's contacts list Using Outlook 0
P Auto scroll to specific folder in Folder Pane Outlook VBA and Custom Forms 3

Similar threads

Back
Top