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)
- 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