How to Auto Minimize Outlook Window after Inactive for a Specific Period

Some users wish that Outlook window can be auto minimized as Outlook has been inactive for a specific period of time, such as 5 minutes. With no doubt, Outlook has no such a native feature. But you still can achieve it with the VBA code shown in this article.

If your Outlook has been idle for a certain time interval, namely you not making any operations in this period, you may hope that Outlook can be auto minimized to keep other applications running smoothly. Many users have this requirement. So, in the followings, we will introduce you a method to realize it.

Auto Minimize Outlook Window after Inactive for a Specific Period

Auto Minimize Outlook Window after Inactive for a Specific Period

  1. At the very outset, launch your Outlook application.
  2. Then, access VBA editor. As for detailed steps, you can refer to the article – “How to Run VBA Code in Your Outlook”.
  3. Next, you ought to open a module.
  4. Subsequently, copy the following VBA code into this module.
Declare Function GetQueueStatus Lib "user32" (ByVal fuFlags As Long) As Long
Const QS_INPUT = ((&H2 Or &H4) Or &H1)
Dim bCancel As Boolean

Sub CheckInactive()
    Do Until bCancel = True
       'Keep Inactive for 10 sec
       'Change it as per your needs
       Call KeepInactive(10)
       If bCancel = False Then MinimizeOutlook
          Do Until GetQueueStatus(QS_INPUT) Or bCancel = True
End Sub

Sub KeepInactive(ByVal lTimeOut As Long)
    Dim dStart As Double
    dStart = Timer
    Do Until bCancel = True
       If GetQueueStatus(QS_INPUT) Then
          dStart = Timer
       End If
       If Timer - dStart >= lTimeOut Then Exit Do
End Sub

Sub StopCheckingInactive()
    bCancel = True
End Sub

'Minimize the Outlook main window
Sub MinimizeOutlook()
    On Error Resume Next
    Outlook.Application.ActiveWindow.WindowState = olMinimized
End Sub

VBA Code - Auto Minimize Outlook Window after Inactive for a Specific Period

  1. After that, you should open the “ThisOutlookSession” project.
  2. Later, copy and paste the VBA code below into this project window.
Private Sub Application_Startup()
End Sub

Private Sub Application_Quit()
End Sub

VBA Code - Activate the Macro

  1. Finally, you need to restart your Outlook application. It will activate the VBA code.
  2. Since then, the macro will start working all the time. As long as your Outlook keeps idle for the predefined time interval, it’ll be minimized automatically.

Repair Compromised PST Files

As we all know, Outlook is susceptible to various issues and corruption. Thereby, Outlook is developed with a built-in repair tool – Scanpst. Yet, this internal utility can only resolve small problems. If the issue you are encountering is quite severe, such as seriously damaged PST file, you have to resort to other much more potent tool, like DataNumen Outlook Repair. It has shouldered over a great amount of its rivals due to its expertise in PST repair and high recovery rate.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including fix sql and outlook repair software products. For more information visit

Comments are closed.