4

I have 2 mail profiles - one profile has a single Exchange 2010 account and the other has a single IMAP account. I want to open an instance of Outlook for each.

I execute outlook.exe /profile MyExchangeProfile for the Exchange profile and outlook.exe /profile MyIMAPProfile for the IMAP profile and the result is that I get 2 instances of Outlook each with the MyExchangeProfile.

In fact, whichever profile I load first is always the one that gets loaded no matter what profile I specify on separate executions.

1
  • Not worked for me with Outlook 2010 / Win7 Pro. Outlook open with the last profile you passed in argument /profile "myprofile". First time you run extraoutlook it open outlook with the profile you asked, and the second time, the first outlook profile instance change automaticaly to the second. Worked with earlier office version. Another idea? Commented May 2, 2011 at 17:36

3 Answers 3

2

Open Two Different Instances Of Outlook With ExtraOutlook

2
  • Should this work with Outlook 2010 and Windows 7? I'm getting error: `Function not found in Import Table.' which to me implies a DLL might is missing, but the .exe was was the only file in the download.
    – Matthew
    Commented Oct 13, 2010 at 22:13
  • Duplicate of answer here - uses the same tool but with more info.
    – HaydnWVN
    Commented Nov 30, 2012 at 16:22
0

I highly recommend you not to do so. Running several Outlook instances is unsupported scenario that leads to corrupted profiles and storages (believe me I saw I lot of these kind of situations).

Instead, add your IMAP account as a second account to your Exchange profile.

1
  • 1
    Hi Thims, I tried @ta.speot.is' suggestion of ExtraOutlook and have been using it successfully ever since. It works great with my two Exchange profiles. My email is continually backed up so I feel safe as well if there's a problem. What is the technical reason for the corrupted profiles and storage?
    – Matthew
    Commented Mar 8, 2012 at 14:58
0

Extraoutlook works great, so great in fact I wrote an interface for the command line, I currently use it to open 22 Exchange profiles simultaneously and update their ost files for keeping a local backup

Code compiled in Autoit https://www.autoitscript.com/site/autoit/

Program has four options

  1. Run a single Profile (runs a single profile at a time )
  2. Add the Auto start (add Profile , user and pass to an ini file )
  3. Run Autostart (opens multiple outlook instances in succession)
  4. Run Autoclose (closes all instances of Outlook)

The code:

;************************************************************
#RequireAdmin

#include <MsgBoxConstants.au3>
#include <guiconstants.au3>
#include <string.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

Global $Font = 'Verdana'
Global $Outlook = 'C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE' ;Office 2010
Global $ExtraOutlook = @SystemDir & "\Extraoutlook.exe"
Global $Process = "OUTLOOK.exe"
Global $IniFile = "outlookprofiles.ini"

Global $Radio[4]

FileInstall("Extraoutlook.exe",@SystemDir & "\Extraoutlook.exe",0)

    If Not FileExists (@ScriptDir & '\' & $IniFile) Then
        Iniwrite($IniFile, "START","Count","0")
        Iniwrite($IniFile, "PROFILE","1","")
        Iniwrite($IniFile, "USER","1","")
        Iniwrite($IniFile, "PASS","1","")
    Else
        _Start()
    EndIf
        _Start()


Func _Start()

$WinMain = GuiCreate('Outlook', 180,215 )

GUISetFont(7,300,'' ,$font)

    $Input1 = GUICtrlCreateInput('Profile',5,15,165,25)
    $Input2 = GUICtrlCreateInput('User',5,45,165,25)
    $Input3 = GUICtrlCreateInput('Password',5,75,165,25)

    $Radio[0] = GUICtrlCreateRadio("", 5, 105, 15, 15)
    $Radio[1] = GUICtrlCreateRadio("", 5, 125, 15, 15)
    $Radio[2] = GUICtrlCreateRadio("", 5, 145, 15, 15)
    $Radio[3] = GUICtrlCreateRadio("", 5, 165, 15, 15)

    $label = GUICtrlCreateLabel("Start Outlook Profile", 25, 105,150,25);
    $label = GUICtrlCreateLabel("Add to Autostart", 25, 125,150,25)
    $label = GUICtrlCreateLabel("Run Autostart", 25, 145,150,25)
    $label = GUICtrlCreateLabel("Run Autoclose", 25, 165,150,25)

    $ButtonOK = GuiCtrlCreateButton('OK', 5,190,80,20)
    $ButtonCancel = GuiCtrlCreateButton('Cancel', 90,190,80,20)

    GUICtrlSetState($Radio[0],$GUI_CHECKED)
    GuiCtrlSetState($Input2,$GUI_DISABLE)
    GuiCtrlSetState($Input3,$GUI_DISABLE)

GUISetState(@SW_SHOW)

    Local $Count = IniRead($Inifile,"START","Count","")
    Local $a = 1
    Local $msg = GUIGetMsg()

    While  $a = 1  ;Infinite Loop

        Switch GUIGetMsg()

            Case $ButtonOK

                    If _IsChecked($Radio[1]) Then
                        IniWrite ($IniFile,"PROFILE",$Count +1,GUICtrlRead($Input1))
                        IniWrite ($IniFile,"USER",$Count +1,GUICtrlRead($Input2))
                        IniWrite ($IniFile,"PASS",$Count +1,GUICtrlRead($Input3))
                        IniWrite ($IniFile,"START","Count",$Count +1)
                        MsgBox(64,"New Profile Added","Profile Name: "  & GUICtrlRead($Input1) & @CRLF & "User: " & GUICtrlRead($Input2) & @CRLF & "Password: " & GUICtrlRead($Input3),10)
                    Else
                        If _IsChecked($Radio[0]) Then
                            If GUICtrlRead($Input1) <> "Profile" Then
                                Run(@ComSpec & " /c " & $ExtraOutlook & " " & '"' &  $Outlook & '"' & " " & "/profile " & $Input1, "", @SW_HIDE)
                            Else
                                MsgBox(64,"","Please Enter a valid Profile name.",5)
                            EndIf
                        Else
                            If _IsChecked($Radio[2]) Then
                                _Autostart()
                            Else
                                If _IsChecked($Radio[3]) Then
                                    _Autoclose()
                                EndIf
                            EndIf
                        EndIf
                    EndIf


            Case $Radio[0]
                    GuiCtrlSetState($Input1,$GUI_ENABLE)
                    GuiCtrlSetState($Input2,$GUI_DISABLE)
                    GuiCtrlSetState($Input3,$GUI_DISABLE)

            Case $Radio[1]
                    GuiCtrlSetState($Input1,$GUI_ENABLE)
                    GuiCtrlSetState($Input2,$GUI_ENABLE)
                    GuiCtrlSetState($Input3,$GUI_ENABLE)

            Case $Radio[2]
                    GuiCtrlSetState($Input1,$GUI_DISABLE)
                    GuiCtrlSetState($Input2,$GUI_DISABLE)
                    GuiCtrlSetState($Input3,$GUI_DISABLE)

            Case $Radio[3]
                    GuiCtrlSetState($Input1,$GUI_DISABLE)
                    GuiCtrlSetState($Input2,$GUI_DISABLE)
                    GuiCtrlSetState($Input3,$GUI_DISABLE)

            Case $ButtonCancel ; Exit the loop.
               Exit
        EndSwitch
    WEnd

EndFunc


Func _IsChecked($idControlID)
    Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED
EndFunc


Func _Autostart()

Local $a = 1

While $a > 0

    If IniRead($Inifile,"PROFILE",$a,"") <> "" Then
        Run(@ComSpec & " /c " & $ExtraOutlook & " " & '"' &  $Outlook & '"' & " " & "/profile " & IniRead($Inifile,"PROFILE",$a,""), "", @SW_HIDE)
        Sleep (15000)
        ;Msgbox(0,"",IniRead($Inifile,"PROFILE",$a,""),3)
        Send("{DOWN}")
        Send("{DOWN}")
        Send(IniRead($Inifile,"USER",$a,""))
        Send("{TAB}")
        Send(IniRead($Inifile,"PASS",$a,""),1)
        Send("{TAB}")
        Send("{TAB}")
        Send("{ENTER}")
        Sleep (25000) ;

        $a = $a +1
    Else
        Exit
    EndIf

WEnd

EndFunc

Func _AutoClose()
    $a = 1

    Do
        If ProcessExists($Process) Then
            ProcessClose($Process)
        Else
            Exit
        EndIf

        Sleep(1000)

    $a = $a +1

    Until $a = 64

EndFunc

;************************************************************
2
  • What version of Outlook and Windows are you running this on again? Commented Aug 25, 2017 at 1:15
  • @2989 Any chance this will work with versions other than 2010?
    – Matthew
    Commented Aug 31, 2017 at 11:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .