I have used the above code for some considerable time and would like to thank all previous contributors for sharing their work/improvements/suggestions. Recently however, I have experienced two unwelcome and irritating issues when it is used in conjunction with Windows 10 (64 Bit) and Outlook 2016 (64 Bit) these are:
The Outlook icon in the System Tray displays a 'cog' overlay with the message "Another program is using Outlook. To disconnect programs and exit Outlook, click the Outlook icon and then click Exit Now".
Attempts to open Outlook from the 'Open Outlook' context menu (right click Outlook icon in the tray) item causes a dialogue box to appear reporting "No active explorer object found". Clicking the "OK" option in response launches Outlook (though issue 1 - cog overlay) remains.
In order to resolve the issues above I set about finding some similar code which I could compile to meet the desired objectives of the original poster (which mirror my own requirements).
The code below is offered "as is" for the wider benefit of other SuperUsers, it is important to note that whilst I have tested the code on two W10 64 Bit systems (both with 64 Bit Office installed) I am still to resolve a RunTime issue on of one systems. The other functions flawlessly. Full details can be viewed here if required: https://stackoverflow.com/questions/45533261/start-outlook-2016-64-bit-automatically-minimised-to-windows-10-64-bit-syste
I will keep you appraised of any developments as testing continues.......
** Quick Update ** Now tested on HP Elitebook 8440P Laptop - Windows 10 Pro 64 Bit with Office 64 Bit + same 12 Outlook Addons - Functions flawlessly as per requirements outlined in the original post above.....
** Further Update ** Tested on a second HP Elitebook 8440P Laptop - Windows 10 Pro 64 Bit with Office 64 Bit + same 12 Outlook Addons - RunTime error experienced again :(
OPTION EXPLICIT
Dim WshShell
Dim OLObj
Set WshShell = WScript. CreateObject ( "Wscript.Shell" )
'Open Outlook: Note that inspite of the launch options, it will open the program in a normal window.
'The file location path is not necessary as Windows 10 correctly identifies Outlook's location.
WshShell.Run "OUTLOOK.EXE" , 3, false
'This will mimimise it to the system tray after a 10 second pause to allow for mail collection on Outlook launch.
WScript.Sleep (10000)
Set OLObj = GetObject("","Outlook.Application")
'Activates the window
OLObj.ActiveExplorer.Activate
'Sends the command to minimise
OLObj.ActiveExplorer.WindowState = 1
'Outlook does not immediately minimise to the system tray so that 'Send/Receive' can initiate mail collection.