Consulting

Results 1 to 3 of 3

Thread: Trigger event - changing sender

  1. #1

    Trigger event - changing sender

    I'm wondering what the trigger events are in outlook. Specifically, is there a trigger when the sender is changed?

    I am able to send emails from different mailboxes and would like to write a small script to change some settings depending on which address I will be sending from.

    I keep forgetting to do certain small things that can get to be pretty aggravating and what I would like to do is have a macro disable the delivery and read receipts when I select a different sender.

    Perhaps there's another way?

  2. #2
    VBAX Mentor skatonni's Avatar
    Joined
    Jun 2006
    Posts
    347
    Location
    Extend the code to include choosing the sender.

    Use SentOnBehalfOfName when creating or replying or forwarding.

    Option Explicit
    
    Sub SentOnBehalf_create()
     
    Dim objMsg As MailItem
    Set objMsg = Application.CreateItem(olMailItem)
    objMsg.SentOnBehalfOfName = "Sender address"
    
    ' code to disable the delivery and read receipts
    
    objMsg.Display
     
    ExitRoutine:
        Set objMsg = Nothing
     
    End Sub
    Note: You cannot set "From" manually and wait until Application_ItemSend. SentOnBehalfOfName will be empty.
    To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx

    If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.

  3. #3
    Awesome, I think this is the way it will work. I suppose this way I'll also avoid forgetting to change the sender name. :P

    Thanks!

Posting Permissions

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