vba to close Outlook's "Enter Network Password" dialog  box.

Posted on 2013-01-11
Medium Priority
Last Modified: 2013-01-20
About once a week Outlook incorrectly displays the "Enter Network Password" dialog which asks us to "Please type your user name and password".

We simply click "OK" and processing resumes normally.

Unfortunately, one computer uses Outlook 2003's NewMailEx subroutine much like a server. Outlooks stays up all night receiving emails which are transfered to an Access database.  

When the server gets the "Enter Network Password" dialog, the send receive stalls while waiting for user to click "OK". The dialog is non-modal, so some of my vba code continues to run, but the NewMailEx routine does not receive anymore emails.

I already have setTimer code that runs every 5 minutes. It continues to run and now detects the hang, but I don't know how to  make vba respond OK or Cancel .

I tried this but it did not help.
   Set SyncObject = myOlApp.session.SyncObjects.item(1)

Does any guru have any suggestions?
Question by:rberke
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2

Accepted Solution

Smighty earned 2000 total points
ID: 38769944
I think you are trying to work around a problem via development when it's better tackled from an administrative point of view.

The dialog pops up under certain circumstances and is - while annoying - mostly not 'incorrect'
Given that you didn't elaborate on your Outlook/Exchange/Sharepoint Infrastructure I will only scratch on the surface:

Outlook connects to shared Calendars, Sharepoint Lists, Public Folders or other opened Mailboxes. Everytime it does that it will check if the User has appropriate rights to all of these items.

There are many more options to check (Exchange Autodiscover; Authentication Methods, etc.)

Author Comment

ID: 38770287
<<I think you are trying to work around a problem via development when it's better tackled from an administrative point of view.>>

That gives me a good idea. The next time the log box occurs, i will check the event logs.

I agree that solving the problem via development is not the ideal, but administrative options seem limited. I administer our SBS 2003, but we use an ISP for email.  (The SBS 2003 Exchange server was configured, but never used.)

With 3 exceptions, our workstation email is "plain vanilla"

We use an ISP, and we have 5 desktops that connect to the server with "normal" pop3 settings.  

The three "non vanilla" exceptions are.

1. our pop3 accounts are set to leave emails on the ISP server for 5 days.  

2. Several of our computers  have vba program programs that interact with an access database. But, the annoying message occurrs even on computers that don't use vba.

3. the third exception is that we have this unattended "pseudo server" which must run overnight. In fact, it is the ONLY computer in which the "enter network password" causes a problem. All the other users imply click "OK" once or twice a week and things continue normally.  

When I contacted the ISP on this problemt they reviewed my Outlook settings, but found they were all fine. They suggested we change our pop3 settings so that the emails are kept on the ISP server for 1 day.  We tried that for several weeks and messages continued to occur about once or twice a week.  The ISP then suggested we STOP leaving the emails on their server, but we are not willing to do that.

I'll keep my out out for event logs and post whatever I find.  But, it might be a while because the problem only occurs once or twice a week.


Author Comment

ID: 38771844
I have a  fairly simple solution, but only because I already have most of the vba code written for other purposes.  If I was starting from scratch, this would be way too complicated.

 I already have a clsSync class module
Pertinent properties are
    Public WithEvents SyncObject As Outlook.SyncObject
    .InProgress boolean which gets turned on and off by inherited methods SyncObject_SyncStart/ SyncObject_SyncEnd
    .LastReceived   date which gets updated by SyncObject_SyncStart  and every time an email is received by NewmailEx  

The class is instantiated with  >>>>> sub application_startup: …….   Set GlobalInstance = new ClsSync

I already use a settimer API so a "monitorSubroutine" is triggered every 5 minutes

I will make the following additional changes to workaround the problem
Sub monitorSubroutine()
    with globalinstance
        if globalinstance.inprogress then
             if now() - GlobalInstance.lastreceived > timevalue("00:20:00" ) then
                  application.quit  ‘ this closes outlook,  but the Enter Network Passord dialog remains on the screen
   End with
End sub

- ----------  RestartOutlook.vbs will have --------------------------
     sleep 20000  ' wait for outlook to close entirely
     taskkill /IM OUTLOOK.EXE /T /F  ' kill Enter Network Password  dialog
     sleep 20000
     shell "C:\Program Files (x86)\Microsoft Office\OFFICE11\OUTLOOK.EXE"
I have tested this solution and the only obvious problem is that outlook needs to recover the PST file because it was not closed properly..

------------ conclusion ----------------------------------
While this is simple, it seems a little drastic.  So, I called my ISP again, and they suggested I use Outlook to  modify myIncoming@mydomain.com account so that   “more settings > advanced”  is 5 minutes instead of 1 minute.

I made that change yesterday and will wait a week to see if their idea solves the problem.
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.


Author Comment

ID: 38771852
I forgot to mention an important point.  I found a simple way to simulate and test the problem.

I change the myIncoming@mydomain.com account so that user name is Xmyincoming@mydomain.com.  Then a manual send/receive will create the Enter User Password dialog.  When I am done testing, I just use the same dialog to remove the X, click OK and everything is back to normal.


Expert Comment

ID: 38796679
The Credential dialog will pop up if you change the Login name, sure. But apart from that I can't grasp exactly why you're getting the dialog in the first place.

You seem to use POP for retrieving mail - which is fine. The retreive intervall could be a problem, but I haven't got it with Outlook in years now with POP3...

the only explanation I do have, is that somehow over night, your connection to the internet is interrupted...

Author Comment

ID: 38799240
We had the problem almost daily until I changed the retrieval interval from 1 minute to 5 minutes.  In the following 5 days we did not have the problem at all, so I think that was the issue.  

This means your original answer that it was an Administrative problem seems to be the correct answer.

Of course, I don't understand exactly WHY it was an issue, but I don't really care as long as I have a solution.  

But, it might be related to the fact that the email account being downloaded to the server is ALSO being downloaded at night by the boss's computer  (as part of his ongoing monitoring of our incoming email).  Theoretically, if the boss gets an email that takes over a minute to download, the server might have to wait for the boss's download to finish.  

In any case, it is time to close this problem.  Thank you for your effort.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question