Start Outlook automatically in tray

11

4

Is there a way to start up Outlook automatically on login, but minimised to system tray (notification area)? I don’t want my inbox showed in my face when I start my PC, only a discrete notification when new mail arrives.

I’m using Outlook 2003, if that matters.

kinokijuf

Posted 2012-08-29T13:23:41.440

Reputation: 7 734

1

Take a look at this article: http://support.microsoft.com/kb/251340

– Reorx – 2014-01-13T10:31:02.393

@Reorx make this an answer – kinokijuf – 2014-01-14T09:00:45.973

Answers

15

Outlook 2010 (x86) on Windows 7 (x64): Launch and Minimize to System Tray on Startup

I know this thread is somewhat old; however, a web search turns up numerous accounts of this problem and I have been unable to find one that provides a working solution. For whatever reason, the normal solutions to this issue do not work in all cases.

Problem:

  • On initial login, the Outlook icon remains visible on the Taskbar forcing one to restore the window and then minimize manually before Outlook will remove itself from the Taskbar.
  • Simply adding the Outlook shortcut to the Startup folder and selecting Hide When Minimized from the context menu of the Outlook Tray Icon does not solve the issue.
  • Using the /Min flag from a batch file or shortcut doesn't work either.

Solution:

  1. Open Outlook manually and right-click the Outlook Tray Icon to verify that Hide When Minimized is checked.
  2. Create a new text file and insert the following code.

    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
    
  3. IMPORTANT! Be sure to change PATH_TO_OUTLOOK to reflect the actual location of your installation.

  4. Rename the text file to whatever you would like with a .vbs extension in order to force Windows to recognize it as a VBScript.

Optional:

  1. Store the script anywhere you would like.
  2. Create a shortcut to the script and place it in the Startup folder instead.
  3. Right-click the shortcut and select properties.
  4. Using the Change Icon button, browse to the location of the Outlook executable and select the Outlook icon stored within the executable.

Performance Improvement:

Instead of placing the script or a shortcut to the script in the Startup folder, the registry can be edited in order to run the script immediately at login.

  1. Follow steps 1-4 in the Solution section above.
  2. Place the script anywhere you would like.
  3. Add a new String Value or a new Expandable String Value if necessary to the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run.
  4. Name it whatever you would like.
  5. Modify the new value you created with the path to the script.

Jason

Posted 2012-08-29T13:23:41.440

Reputation: 155

Works great with Windows 8.1 and Office 2013! Only thing that needs to change is that the PATH_TO_OUTLOOK should be Office15 instead of Office14. Also you need to add HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Preference\MinToTray to the registry with a value of 1. – Nate – 2014-08-08T17:04:06.343

When I execute this script manually from my Startup folder, it does start minimized, but the Outlook icon is stuck in my taskbar. I'd like it only in my tray. When I activate Outlook with the taskbar icon and then minimize it, it goed to tray and leaves the taskbar as expected. – rolandow – 2016-12-20T06:57:17.773

@rolandow The problem with the icon staying in the taskbar is mentioned in the first part of the problem description. If it is not working correctly, it is most likely a timing issue. I've found that adding it to the registry as suggested usually resolves any timing issues due to the way windows executes items during startup. Another thing you can try is to change the value of the Wscript.Sleep(XXX) value. – Jason – 2017-01-28T01:59:39.950

I notice you have an unregistered and a registered user - You can, and certainly should merge these by using the contact us link right at the bottom of the page – Journeyman Geek – 2013-04-06T09:10:28.657

7

Outlook has no built-in feature for this, but you can use the start command:

  1. Create a shortcut in your Startup folder pointing that executes the command

    cmd /c start /min "" "FullPathOfOutlook.exe"
    

    or a batch file containing the command

    @start /min "" "FullPathOfOutlook.exe"
    
  2. Right-click the tray icon and check Hide when minimized.

Dennis

Posted 2012-08-29T13:23:41.440

Reputation: 42 934

It does start out minimized but it's still present in the taskbar, you have to open and click on minimize to hide it to the tray. – Max – 2014-07-29T13:38:29.323

Does not work. Outlook still starts maximised. – kinokijuf – 2012-08-29T13:54:31.717

Maybe I wasn't clear. I'm using the above method (with the batch file) on my computer. It works. – Dennis – 2012-08-29T14:15:15.863

What version of Outlook do you have? – kinokijuf – 2012-08-29T14:18:55.827

Outlook 2007, but that shouldn't matter. I use start to minimize many startup applications, and it works with all of them. – Dennis – 2012-08-29T14:21:35.853

I can confirm what Dennis is saying. On my XP machine with Outlook 2003, I use start /min "" "C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.exe" in a batch file in the Startup folder and it opens minimized when I log in. I do the same with my Win7/Outlook 2010, but just a different path. – jb11 – 2012-08-29T16:32:43.097

0

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:

  1. 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".

  2. 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.

PC Pilot

Posted 2012-08-29T13:23:41.440

Reputation: 15

0

I did some search and tests and finally found that the vbscript code following worked in my Win10 laptop:

set shell = createobject("wscript.Shell")
shell.run "outlook.exe", 7, False     '... SH_SHOWMINNOACTIVE=7 "should" work
shell.sendkeys "% n"     ' ... Minimize Alt Space Bar - n

Just set it as an action in Task Scheduler, and do it like how you make a startup application.

Aerix Chan

Posted 2012-08-29T13:23:41.440

Reputation: 1

0

I like the top answer, but I don't like that it's in CScript... So I made it in PowerShell...

It works flawlessly with Windows 10 and Office 365.

Colour formatted here: https://gist.github.com/NotoriousPyro/d30a96d2a89cf783ef3081b13d4816a0

<#
.Synopsis

Automatically finds, runs and places Outlook into the system tray.

.Description

Automatically finds, runs and places Outlook into the system tray.
By default, Outlook will start full-screen even when you have the option to minimize tray enabled and start the app as minimized.

This requires that the OUTLOOK.EXE tray icon is enabled and that the minimize to tray option is on.

Author: NotoriousPyro (Craig Crawford)

#>

$autostartOutlook = $true

$outlook = Invoke-Command -ScriptBlock {
    $versions = Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Office" | Where-Object { $_.Name -like '*.*' } | Sort-Object -Property Name -Descending

    $outlookexe = $versions.ForEach({
        $path = 'Registry::' + $_.Name
        try
        {
            $versionPath = Get-ItemProperty -LiteralPath (Join-Path $path 'Outlook\InstallRoot') -Name Path -ErrorAction SilentlyContinue
            $installRoot = ($versionPath).Path
        }
        catch {}

        if ($installRoot -ne $null)
        {
            $outlookexe = Join-Path $installRoot 'OUTLOOK.EXE'

            if (Test-Path -Path $outlookexe)
            {
                return $outlookexe
            }
        }
    })
    return $outlookexe
}

Add-Type -TypeDefinition '
public enum ShowStates
{
    Hide = 0,
    Normal = 1,
    Minimized = 2,
    Maximized = 3,
    ShowNoActivateRecentPosition = 4,
    Show = 5,
    MinimizeActivateNext = 6,
    MinimizeNoActivate = 7,
    ShowNoActivate = 8,
    Restore = 9,
    ShowDefault = 10,
    ForceMinimize = 11,
}
'

$User32Definition = @'
    [DllImport("user32.dll")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
    [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr hWnd);
'@

# add signature as new type to PowerShell (for this session)
$User32 = Add-Type -MemberDefinition $User32Definition -Name User32 -PassThru

$maxLoops = 10; $loops = 0

do
{
    $outlookHandle = Get-Process OUTLOOK -ErrorAction SilentlyContinue

    if (-not $outlookHandle -and $autostartOutlook)
    {
        Write-Verbose "Starting OUTLOOK.EXE from $outlook"
        Start-Process $outlook
        Start-Sleep -Seconds 2
    }

    if ($outlookHandle)
    {
        $windowHandle = $outlookHandle.MainWindowHandle

        Write-Verbose "OUTLOOK.EXE is running..."

        if ($User32::IsWindowVisible($windowHandle))
        {
            Write-Verbose "OUTLOOK.EXE is visible... attempting to minimize..."

            $minimized = $User32::ShowWindowAsync($windowHandle, [ShowStates]::Minimized)

            Start-Sleep -Seconds 2

            if (-not $minimized)
            {
                Write-Verbose "Failed to minimize OUTLOOK.EXE... Outlook may still be starting..."
                $outlookHandle = $null
            }
            elseif (-not $User32::IsWindowVisible($windowHandle))
            {
                Write-Verbose "OUTLOOK.EXE is now minimized"
                break;
            }
        }
        else
        {
            Write-Verbose "OUTLOOK.EXE not visible..."
            break;
        }
    }

    Write-Verbose "Waiting for OUTLOOK.EXE to be ready, attempt: $loops of $maxLoops"

    $loops += 1
}
until ($outlookHandle -ne $null -or $loops -ge $maxLoops)

NotoriousPyro

Posted 2012-08-29T13:23:41.440

Reputation: 101

0

if you are able to open outlook from command line by typing outlook.exe, then create a batch file including this code start /b /min outlook.exe and place it in your windows startup folder.

Renju Chandran chingath

Posted 2012-08-29T13:23:41.440

Reputation: 1 461

0

When using quotes with the START command on Windows 7 with Outlook 2010, a new command window will open, but Outlook will not launch. This happens with the 32bit versions of Windows 7 Pro and Enterprise editions (both with the most recent updates). I can't say if it happens with 64bit versions or other editions.

To resolve that issue, you must omit any quotes that surround the "path\program" you're wanting to launch with the START command. However, since there are usually spaces in the path name, you'll likely receive a different error unless you truncate the path (shorten it). The truncated names in the path can vary if you have multiple Microsoft products installed. To obtain the correct truncated path, use the following command line at a DOS prompt (in a CMD window): FOR /D %T IN ("C:\Program Files\Microsoft Office\Office14\Outlook") DO ECHO %~sT

Here is an example that worked for me when using the results obtained from above: START /MIN C:\Progra~1\Micros~1\Office14\Outlook

NOTE: Office14 refers to version 2010 whereas Office12 refers to version 2007. Also note that the .exe at the end of Outlook.exe is not required in these command lines.

Klaralina

Posted 2012-08-29T13:23:41.440

Reputation: 1

Is there some reason why you think this is better than start /min "" "FullPathOfOutlook.exe"? – Scott – 2014-08-16T00:26:26.170