• How to Test if Outlook is Open or not?

    Are you automating any task with Ms Outlook App?

    Then, sometimes, you need to verify that the Outlook is already running in machine or not.

    Here is the code… But wait…

    Read the important note below the code.


    In the above code, the Vba.Shell command will open the Outlook Application if it is not already running.

    Note: To explicitly open Outlook send/receive use this line in your vba code. ObjOutlook.Application.GetNamespace(“MAPI”).SendAndReceive (True)

    Once this is executed, you can see that “Send/Receive” window is opened & Outlook will start processing the emails in outbox.

    Also Read: Create Keyboard Shortcut - to VBA Macro code - in Excel

    Outlook running or not – Why the check is performed?

    When you are sending any automatic mass/bulk marketing emails using Vba, then Outlook will start sending the emails only when it is running. It is not enough to create an object.

    For this purpose, we check if it is already running or not & then act accordingly.

    Usually developers use late-binding for initiating an object with Outlook.Application. There is not much of a need to check whether it is already running or not.

    If you are using early binding for Outlook App, then include reference to “Microsoft Outlook Library” from Tools -> References. Many times, this will be a problem, if the destination machine is having a lower version of Office than that you are coding.

    So, it is better to use late-binding for Office Apps like Outlook & Word.


    Previous Post:
    Next Post: