-->

How to Minimize/Maximize Outlook Mail Window?

Are you automating outlook through excel?

New Email Creation in Outlook

Situation: If you are automating procedure of creating multiple brand new outlook emails through excel and you may come across to the situation minimize the mail item once it created through macro.

Solution: Please use the below code to minimize/maximize the outlook mail item window.

The special one is that using the "getinspector" will make your job get done.


'Use the below code to Minimize/Maximize the Outlook mailtiem window

Sub MinimizeMaximizetheMail()
 Set OutApp = CreateObject("Outlook.Application")
 Set OutMail = OutApp.CreateItem(olmailitem)

'----------------------Creating content in a New Mail ------------------------
    
    With OutMail
        .to = "name@domain.com"
        .cc = "name1@domain.com"
        .bcc = "name2@domain.com"
        .Subject = "Test"
        .body = "Testing the mail"
        
        
 '----------------------Minimize/Squeeze/Maximize the mail item ------------------------
        Set ObjInspector = OutMail.getinspector   '-----Assigning current mail item to an object variable
        ObjInspector.Display       '----- This step will Display the mail in front of you. (Optional)
        ObjInspector.WindowState = 2        '----- Squeez the currently working mail.
        ObjInspector.WindowState = 1        '----- Minimize the currently working mail.
        ObjInspector.Display   '----------------- Maximize the mail again.
             

'----------------------Send your Mail ------------------------
        .send
             
    End With

End Sub

How to Minimize/Maximize Outlook Mail Window?