Automate Outlook Start - No Active Explorer Object Found

PC Pilot

New Member
Outlook version
Outlook 2016 64 bit
Email Account
POP3
Hi Everybody,

Firstly as a newcomer here I hope that this thread is posted in the correct forum and if not my apologies and trusting that the moderators will advise and relocate as appropriate!

I am hoping that one of the forum experts can help me solve a recurring issue surrounding automating the Start of Outlook 2016 64 Bit (but I feel certain that the issue will occur in other earlier versions and in 32 bit).

For ease of use I like to launch Outlook at Windows logon with it minimised to the system tray from where it collects mail discretely for subsequent view/action as required. I have done this for many years certainly since Outlook 2003 through 2007, 2010, 2013 and now 2016. Friend's whose PC's I support also like this useful customisation which I have incorporated on to their systems. In total this involves around 8 PC's all presently using Windows 10 64 Bit (although one is a 32 Bit version due to legacy hardware limitations).

As my coding skills are at best rudimentary I have use a variety of vbscript code itterations over the years all kindly posted or offered by other users on the web. The changes were always due to issues arising from the new Office releases the last of which being an annoying dialogue box reporting "No active explorer object found" and also that the tray icon displayed a 'cog overlay' indicating that Outlook is being used by another program.

The issue remained unresolved until quite recently when I built a new X99/i7 state of the art system which brought the opportunity to finally resolve the issue from the outset using refined code to accomplish the task efficiently. Accordingly, my enquiries resulted in the following 5 lines of code kindly offered following questions asked on an online forum and for which I am of course most grateful:

Set WshShell = CreateObject ( "Wscript.Shell" )
WshShell.Run "OUTLOOK.EXE" , 3, False
Set ol = CreateObject("Outlook.Application")
ol.ActiveExplorer.Activate
ol.ActiveExplorer.WindowState = 1

This was duly compiled to a .vbs file and a shortcut to it created in the Startup folder. A subsequent revision was made to incorporate a registry string pointing to the (now relocated) shortcut to run automatically at login. I was delighted that in both of these configurations the process performed to perfection.

Two days ago I experienced an (unrelated) issue with my Linksys Router and following the direction of the Linksys telephone support staff which only involved (so far as the PC/Operating System was concerned) re-configuring both Gigabit Ethernet Adapters to an assigned IP Address and back again to receiving the ISP Generated IP Address (OS default setting). Also the temporary installation of the Telnet Client (which in the event was actually never used) NB. I only mention these because the issue only arose after those changes were made though I cannot imagine any way in which they might be related :(

Following the above changes the system was rebooted and immediately reported "No active explorer object found" as the script was initiated. The Outlook icon is displayed upon the taskbar and clicking upon the box's 'OK' (only) button opens Outlook in a fully maximised window but the script obviously does not continue. The script appears to fail upon the line " Set ol = CreateObject("Outlook.Application") " and experimentation confirms this is the case. I seem to recall that this part of the script invokes the automation functions within Outlook, perhaps someone can confirm this?

I am totally mystified as to why a perfectly flawlessly operating feature should so suddenly fail in this manner and I am at a loss to figure out what has occured. In attempt to return things to their previous good function I chose a recent restore point prior to the issue and successfully performed the restore, regrettably this does not improve the outcome :(

Hopefully somebody can suggest what is going on, how/where to identify the cause and of course resolve the problem. It might help if someone could elaborate (in simple language) as to precisely just how the faulting code line normally works and how this relates to the dialogue box error. As noted above this has occured previously with other code on other systems though never before when previously functioning flawlessly.

No other changes have been made either to the Operating System, Office 2016 or Outlook 2016. Additionally, the same applies to the Outlook Addins, no changes from the previously perfect setup. NB. Add ins include Adobe Acrobat and various CodeTwo free addins.

Incidentally, to preserve data integrity I have customised each of the above systems such that the user folders are redirected to a discrete HDD location usually D: or E: (as in this case) similarly the default PST file location for the POP mail is located here and not to the usual Outlook default. Similarly, the vbscript file and it's associated shortcut are also maintained in a sub directory here. Again this directory structure has not changed between the original success and the subsequent failure......only mentioning in case it is relevant.

Does any off this make any sense to the forum regulars?

All help and advice gratefully received.

Many thanks in advance,

PC Pilot
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
All Set ol = GetObject(, "Outlook.Application") does it tells the system to create an outlook application if one does not exist.
It sounds like something else it trying to open Outlook too and causes createobject to stall. See if this works -

Code:
Set WshShell = CreateObject ( "Wscript.Shell" )
WshShell.Run "OUTLOOK.EXE" , 3, False
On Error Resume Next
   Set ol = GetObject(, "Outlook.Application")
        If ol Is Nothing Then
        Set ol = CreateObject("Outlook.Application")
        End If
ol.ActiveExplorer.Activate
ol.ActiveExplorer.WindowState = 1
Is there a reason you use the script and not a shortcut to outlook.exe in the startup folder?
 

PC Pilot

New Member
Outlook version
Outlook 2016 64 bit
Email Account
POP3
Hi Diane,

Thanks for your swift response, very much appreciated!

Indeed as you probably suspected there is a reason, simply adding the shortcut to the Startup folder as you have suggested does not unfortunately satisfy the required outcome of a discrete startup, minimised to the system tray whilst active and collecting mail as scheduled but importantly without ANY user intervention.

In fact, on initial login, the Outlook icon remains visible on the Taskbar forcing the user to restore the window before then manually minimising before Outlook will remove itself from the Taskbar into the System Tray (assuming that hide when minimised is selected from the tray icon's context menu). Far from the clean solution required :(

Additionally, using the /Min flag from either a batch file or shortcut doesn't work either. In fact the ONLY solution I have found to this is vbscript........as noted in my earlier reply this indeed WAS a truly perfect solution!!

Given this additional information can you suggest what might be going on here?

Thanks again,

PC Pilot.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
In fact, on initial login, the Outlook icon remains visible on the Taskbar forcing the user to restore the window before then manually minimising before Outlook will remove itself from the Taskbar into the System Tray (assuming that hide when minimised is selected from the tray icon's context menu). Far from the clean solution required :(
it worked in a quickie test here. I had the shortcut set to minimize on startup on the option set to min to tray.

Do you have skype or some other program loading that uses outlook data? does the code sample i suggested help?
 

PC Pilot

New Member
Outlook version
Outlook 2016 64 bit
Email Account
POP3
Hi Diane,

Thanks for your input and my apologies for the partial reply.......It was late here in the UK when I received your response and so I wasn't able to test the code by the time I posted......meant to acknowledge that fact in my reply but sadly omitted it....tired by then I guess!! A more suitably comprehensive response is now provided.

I have now had the opportunity to conduct some testing using the revised code you kindly provided and unfortunately I got the same result....which is very strange as I had expected the 'On error resume next' to have an effect.

My next question you already answered (in part at least) namely as to what (program) could be interrupting the process. Having previously disabled each of the Outlook add-ins in turn with no success I have repeated the process on the previously good system once more using your modified code and it appears that the culprit is CodeTwo's 'Move & Delete Watchdog' Add-in.....

I remain puzzled as to why this behaviour should emerge so suddenly and seemingly spontaneously, however I wonder if it is perhaps an issue of Outlook Add-in loading sequencing if that even possible? If so, what could cause the sequence to change so abruptly? Finally is there any way to apply a loading delay (similar to that for the Windows Startup items) to the COM Add-ins?

Sorry to keep delving but I am keen to learn and understand how the process functions so as to aid troubleshooting the other system were the original code failed with a Run Time Error (ActiveX component can't create object: 'Outlook.Application' - Code: 800A01AD). Here, your revised code starts OK (Outlook Tray Icon appears with a cog overlay) but the tray icon disappears and Outlook then reported that it should be started in safe mode. Unfortunately this also fails and Outlook closes. An Office Repair has also not helped :( so it looks like the original problem was some form of corruption and so I may have to uninstall and reinstall all over?

Thanks again for taking the time to offer assistance it is very much appreciated!

Best regards,

PC Pilot
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
On codetwo - try reinstalling or repairing it (if they offer a repair option). Unfortunately, there isn't a way to force an addin to delay loading.
 

PC Pilot

New Member
Outlook version
Outlook 2016 64 bit
Email Account
POP3
Hi Diane,

We must be very much on the same page here! I was about to report that I had tried both the repair and uninstall/re-install of the Move and Delete Watchdog Add-in and that in spite of this the issue persists.

I realise that I am repeating myself here but I am at a loss as to what could have spontaneously changed to cause this, and why it should have functioned so flawlessly from when the code was initially incorporated given that nothing apparently related appears to have changed?

Your comment concerning delayed start up is noted and indeed concurs with my own limited understanding of the MS Office products. I even investigated whether the 'LoadBehavior Values' could be modified through registry to accomplish the task but as noted here Registry Entries for VSTO Add-ins the available values do not cover that particular option as I am sure you are aware.

Further research on the subject has however led me to the following web page Delay Loading Outlook Add-ins which along with it's associated code/add-in is offered here GitHub - davecra/DLAME: Outlook Delayed Load Add-in Manager for the Enterprise I was wondering whether this could in any way be adapted for the regular editions of Office/Outlook 2016?

It would appear that the delay issue continues to arise with numerous examples on the net of people enquiring how it can be achieved! I am somewhat surprised that over the years the option has never been offered by Microsoft to accomodate solutions were this would be useful.

I look forward to hearing your further thoughts in due course.

Best regards,

PC Pilot
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
That should work on all versions - install it & set the registry key then test it.
 

PC Pilot

New Member
Outlook version
Outlook 2016 64 bit
Email Account
POP3
Hi Diane,

Thanks for the wonderfully prompt response as ever!......had you come across this before?

I guess I was a little intimidated by the statement "You will need to load it into Visual Studio and compile it and then sign it with a certificate on your own." which I felt was perhaps getting beyond my capabilities!!

If however, all that is required (as per GitHub page) to install is to "Locate the “DLAME.vsto” and double-click on it" then I am quite happy to proceed from there and make the appropriate registry changes.....

I will give it a try over the next 24 hours and let you know if I encounter any issues...

PC Pilot
 

PC Pilot

New Member
Outlook version
Outlook 2016 64 bit
Email Account
POP3
Hi Diane,

Sorry for the protracted delay in reporting (as promised) my findings on the DLAME addin.

I have to say that it feels as if I have been on quite a journey, one in which I have learned new skills and further broadened my (somewhat limited) horizons so far as the various software platforms are concerned!!

I am now happy to report that in conjunction with the code modifications you kindly provided that the above addin has successfully resolved the apparent conflict which was causing the automated start of Outlook 2016 to fail on launch.

However, much as I anticipated, there was to be a lot more to the process than simply to "Locate the DLAME.vsto and then to double-click on it". In fact, to enable the addin to function it required the project files to be compiled within Visual Studio and a digital certificate incorporated before completing the compiled project to a release build.....all of this previously beyond my very limited technical abilities and hence the delay in reporting back!

For the benefit of yourself and especially for other forum users who, perhaps like myself, may lack the technical know how to undertake this process and yet would likely find this delay function a useful way of resolving issues of Addin conflicts at startup I thought it would be helpful to provide a Step by Step walk through.

Accordingly, I have outlined the additional steps I found necessary to prepare the generously offered Addin project for successful installation to Outlook 2016 (64 Bit) in the attached text file which I hope will help others. I can also advise that I tested the process in both Visual Studio (Professional) 2015 & 2017 taking advantage of the free 30 day trial rather than using the Community release versions which I am sure would also have been adequate.

The Pre-requisites

1. Download and install Aloaha Certificate Creator <http://www.aloaha.com/download/AloahaCertificateCreator.zip>
2. Download and install Microsoft's Visual Studio 2015 or 2017

The Install Proceedure

See attached text file for the complete step by step process followed to successfully compile, build and install the DLAME project files.

I hope that you can give the attached text document a quick look through and from the perspective of your considerable experience to perhaps suggest any refinements which my own bumbling attempt clearly lacks. Despite many failures, I was never the less, through trail and error, eventually successful in getting the addin loaded and successfully configured so as to fully resolve my issue.

I look forward to your comments in due course as I am always keen to learn from the many experts who, like yourself, so freely offer their guidance for the benefit of others which as I noted previously is so very much appreciated by this forum user!

Very best regards,

PC Pilot
 

Attachments

PC Pilot

New Member
Outlook version
Outlook 2016 64 bit
Email Account
POP3
Hi again Diane/everyone,

At the time of writing I had only explored the standard install method to install for the Current User only and not as alternately globally for All Users (i.e. to the HK Local Machine Registry Hive).

Initially I followed the script provided by the developer in his/her write up on the installation procedures however I failed to notice the slight grammatical error where the switches were shown in the script as "\i" and "\s" and not correctly as "/i" and "/s" which caused the script to fail.

The corrected scripts are now shown below in bold text. Additionally, as my path contains spaces it was necessary to include "" quotes at each end of the path, as shown below in italics.

A little further experimentation enabled me to isolate the error and then to successfully install for "All Users" by inserting the following line of script in the "Run" command dialogue "Win+R".

%commonprogramfiles%\microsoft shared\VSTO\10.0\VSTOInstaller.exe /i "X:\Full Install Path\to where you saved\DLAME.vsto"

.....and should you wish to install silently, the /s switch can additionally be inserted as shown below:

%commonprogramfiles%\microsoft shared\VSTO\10.0\VSTOInstaller.exe /i /s "X:\Full Install Path\to where you saved\DLAME.vsto"

Similarly, to Uninstall:

%commonprogramfiles%\microsoft shared\VSTO\10.0\VSTOInstaller.exe /u "X:\Full Install Path\to where you saved\DLAME.vsto"

On the subject of the registry location where your Outlook Addin's reside, I discovered that mine were distributed across the following hives:

HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\Addins

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\Addins

and on the 64 Bit hive:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Office\Outlook\Addins

I trust forum users will find this additional information useful!

Best regards,

PC Pilot
 
Top