none
application_startup doesn't excute

    Question

  • When you create an email from another app like SentTo from Excel or email button in Access as well as 'mailto:' links from browser, the mail item is displayed and outlook.exe runs, but my application_startup() doesn't fire.  Is there way to get the startup code to fire in this case? 

    The problem is, I need to force a send/receive in this case before outlook exits, otherwise items sit in outbox.  I can force this with Application_Send() like below, but it seems the code in ThisOutlookSession is not loading when outlook mail item is displayed.

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    If vbYes = MsgBox("Send Now?", vbYesNo, "Send Immediately?") Then Session.SendAndReceive (True)
    End Sub
    
    Sub STARTUP()
        Application_Startup
    End Sub
    
    Sub Application_Startup()
        MsgBox "Startup"
    End Sub

    Thanks,

    Josh

     
    Wednesday, July 24, 2013 6:12 PM

All replies

  • That's always the case when Outlook is started using Simple MAPI. You would need to use Outlook COM addin code set up to work with no Explorer UI, only modal Inspector UI.

    Ken Slovak MVP - Outlook

    Wednesday, July 24, 2013 6:40 PM
    Moderator
  • Thanks Ken.  Before I look into add-in may I clarify?...

    Will a properly configured add-in automatically load when Outlook is started using Simple MAPI so that users can continue to use simple MAPI?  Or are you saying I need to have folks use OL code to create mail items instead of use the Simple MAPI OS default mail app?

    Do you have a quick link to such a modal inspector sample add-in?

    Thanks,

    Josh


    • Edited by joshbooker Wednesday, July 24, 2013 6:48 PM spell
    Wednesday, July 24, 2013 6:47 PM
  • Outlook has never supported any addins to run against Simple MAPI.

    You have to specially code for it and handle the problems that come up, such as modal Inspector windows that don't close when you automate them, and an Inspector that is in the Inspectors collection but never fires the NewInspector() event.

    There's nothing documented for that, as it's not supported. Some people have worked out methods of handling all or most of the problems, but again nothing's documented for the most part.


    Ken Slovak MVP - Outlook

    Wednesday, July 24, 2013 7:03 PM
    Moderator
  • startup event won't fire, but code for loading ribbon customizations will, so add a button to mail compose ribbon and provide callback for getvisible - always return false so nothng from you will be shown but your code will be invoked.
    Thursday, July 25, 2013 6:25 AM
  • You'd still need a COM addin, the ribbon can't be handled in Outlook from VBA, only from a COM addin.


    Ken Slovak MVP - Outlook

    Thursday, July 25, 2013 1:51 PM
    Moderator