Answers for "commandline to open outlook minimized"

C#
0

commandline to open outlook minimized

OPTION EXPLICIT

CONST PATH_TO_OUTLOOK = """C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE"""
CONST SHOW_MAXIMIZED = 3
CONST MINIMIZE = 1

DIM shell, outlook

SET shell = WScript.CreateObject("WScript.Shell")

' Open Outlook
shell.Run PATH_TO_OUTLOOK, SHOW_MAXIMIZED, FALSE

ON ERROR RESUME NEXT

' Grab a handle to the Outlook Application and minimize 
SET outlook = WScript.CreateObject("Outlook.Application")
WScript.Sleep(100)
outlook.ActiveExplorer.WindowState = SHOW_MAXIMIZED

' Loop on error to account for slow startup in which case the
' process and/or the main Outlook window is not available
WHILE Err.Number <> 0
  Err.Clear
  WScript.Sleep(100)
  SET outlook = NOTHING
  SET outlook = WScript.CreateObject("Outlook.Application")
  outlook.ActiveExplorer.WindowState = MINIMIZE
WEND

ON ERROR GOTO 0

SET outlook = NOTHING
SET shell = NOTHING
Posted by: Guest on March-25-2021

C# Answers by Framework

Browse Popular Code Answers by Language