dcsimg
Results 1 to 9 of 9

Thread: [RESOLVED] Adding warning box before sending outlook 2016 emails

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2019
    Posts
    3

    Resolved [RESOLVED] Adding warning box before sending outlook 2016 emails

    Hi there

    I have managed to add the following as a warning before I send emails in Outlook 2016:

    HTML Code:
    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
        If MsgBox("You are sending a mail. Have you checked your spelling, grammar, and formatting? Have you spelt the recipients name correctly? Do you have the correct recipients? Are you sure you want to send the e-mail?", vbYesNo + vbExclamation + vbApplicationModal + vbMsgBoxSetForeground, "External Mail Alert!") = vbNo Then
            Cancel = True
        End If
    End Sub
    Two questions:

    1) How do I turn off the ping sound when it appears before I send an email?
    2) It was working fine yesterday, however today I have booted up and sent an email and the warning didn't appear - How do can keep it on at all times when outlook 2016 is open?

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,554

    Re: Adding warning box before sending outlook 2016 emails

    1. you could use a vba userform as a design your own msgbox
    it would probably be possible to mute the volume while the msgbox opens, but probably not worth the amount of code

    2. does your macro security allow macros to run by default?
    did you actually save the code in your outlook before closing?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2019
    Posts
    3

    Re: Adding warning box before sending outlook 2016 emails

    Quote Originally Posted by westconn1 View Post
    1. you could use a vba userform as a design your own msgbox
    it would probably be possible to mute the volume while the msgbox opens, but probably not worth the amount of code

    2. does your macro security allow macros to run by default?
    did you actually save the code in your outlook before closing?

    I can probably live with the sound, to be honest

    Regarding the code running, I'm not hugely technical but pressing Alt + F11 I can still see the code fine. On the right-hand side, it is labelled as "this outlook session" - assume I need to change it to "all outlook sessions"? If that's the case how do I do that?

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,554

    Re: Adding warning box before sending outlook 2016 emails

    assume I need to change it to "all outlook sessions"?
    afaik no such thing, you are in the right place now, i do not believe events can be turned off in outlook as they can in other office applications, so they should always run, but if any other code is suspended (paused) the events will not fire

    it should just work
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2019
    Posts
    3

    Re: Adding warning box before sending outlook 2016 emails

    Quote Originally Posted by westconn1 View Post
    afaik no such thing, you are in the right place now, i do not believe events can be turned off in outlook as they can in other office applications, so they should always run, but if any other code is suspended (paused) the events will not fire

    it should just work
    Sadly it doesn't - any advice or a way I can reset it maybe?

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,554

    Re: Adding warning box before sending outlook 2016 emails

    did you check your macro trust centre settings, macros are disabled by default for unsigned macros

    i did a quick test in outlook 2013 application.startup, did not work till i enabled all macros

    this setting is not recommended, so up to you if you choose to, the alternative is to digitally sign your macros, google digitally sign outlook macros for more information
    as i use office more, for running code, than working with documents, mine is always macro enabled
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7
    Frenzied Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    1,108

    Re: Adding warning box before sending outlook 2016 emails

    Quote Originally Posted by ToneMGMT View Post
    Hi there

    I have managed to add the following as a warning before I send emails in Outlook 2016:

    HTML Code:
    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
        If MsgBox("You are sending a mail. Have you checked your spelling, grammar, and formatting? Have you spelt the recipients name correctly? Do you have the correct recipients? Are you sure you want to send the e-mail?", vbYesNo + vbExclamation + vbApplicationModal + vbMsgBoxSetForeground, "External Mail Alert!") = vbNo Then
            Cancel = True
        End If
    End Sub
    Two questions:

    1) How do I turn off the ping sound when it appears before I send an email?
    2) It was working fine yesterday, however today I have booted up and sent an email and the warning didn't appear - How do can keep it on at all times when outlook 2016 is open?
    Not really adding anything technical to the discussion but more of a question on why this is needed? Outlook has an option to always check spelling before sending and more recent versions will check grammar as well. If you are running in a windows domain then this can even be forced by a group policy to prevent the users disabling it.

    If that message box is displayed ever single time a user clicks send they will just get into the habit of clicking "yes" without even reading the message anyway.

  8. #8
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,697

    Re: Adding warning box before sending outlook 2016 emails

    PD is correct and what I was going to post. Use the built in option to check spelling before sending emails.

    If unsigned macros are disabled by your works policy you can always create a cert and self sign it to get the macro to run.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,697

    Re: Adding warning box before sending outlook 2016 emails

    PD is correct and what I was going to post. Use the built in option to check spelling before sending emails.

    If unsigned macros are disabled by your works policy you can always create a cert and self sign it to get the macro to run.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width