Run an Outlook VBA subroutine in the background

Ariel Rogson 41 Reputation points
2025-12-15T20:31:06.48+00:00

I have a VBA subroutine that executes in Outlook. This subroutine loads some globally accessible data for my other macros.

This subroutine can take a long while (approximately 30 seconds) to complete its operation, as there is a lot of global data to load. Nothing else in Outlook depends on loading this data other than my own macros, all of which must be manually invoked by the user. Given normal usage of Outlook, these macros will not be invoked until well after the data is fully loaded, so there is no concern about timing (trying to invoke a macro before the global data has been loaded). So, I would like this subroutine to execute as a background "process" (whatever the correct term might be) in Outlook, so that normal use of Outlook can proceed while the global data is being loaded.

I know that forms may be shown as non-modal, in which case Outlook may be used while the form is displayed. But I don't want anything displayed on the screen while the global data is being loaded. So, using a method of a form is not an option.

Is there any way to trigger execution of this subroutine as a background "process", so that other operations (including ordinary use of Outlook) can proceed while the subroutine is executing?

Thanks in advance, even if the answer is a resounding "No". I would just have to live with the delay if there is no answer to my question.

Microsoft 365 and Office | Other
{count} votes

Answer accepted by question author
  1. Kimberly Olaño 20,085 Reputation points Independent Advisor
    2025-12-15T21:40:50.4+00:00

    Thanks for sharing the details, Ariel! Short answer, no, not in pure Outlook VBA.

    Outlook VBA runs on Outlook’s main UI thread

    While a VBA procedure is executing, Outlook’s UI is blocked

    VBA has:

    • no threading
    • no async / await
    • no background workers

    So a long-running subroutine (30 seconds in your case) will always block Outlook while it runs.

    What can be done (realistic options)

    1. Yield control with DoEvents (best you can do inside VBA)

    This does not create a background process, but it allows Outlook to remain responsive (mouse clicks, window redraws, etc.) while your code runs.

    Sub LoadGlobalData()

    Dim i As Long

    For i = 1 To 100000

    ' Load part of your data here

    If i Mod 100 = 0 Then

    DoEvents ' allow Outlook to process UI messages

    End If

    Next

    End Sub

    Pros

    Outlook doesn’t look “frozen”

    Simple

    Cons

    Still blocks other VBA

    Still one long operation

    Not truly background execution

    This is the maximum capability VBA itself offers.

    See if this helps. If you need further assistance just let me know.

    Best regards,

    Kimberly


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.