Improve company productivity with a Business Account.Sign Up


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
  • 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 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.
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.


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 account so that user name is  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

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article presents several of my favorite code snippets.
In a Cross Forest, the steps to migrate users are quite complicated and even in the official articles of Technet there is no clear recommendation on which approach to take .. From an experience, I mention and simplify which way to go and how to use …
Watch the video to know the simple way to remove or recover or reset lost or forgotten passwords of Outlook PST file. With Kernel Outlook Password Recovery tool such operation is very easy to perform. It is a freeware with limitation to use with 500…
Watch the video to know the process of migration of Exchange or Office 365 mailboxes in absence of MS Outlook. It is an eminent tool which can easily migrate Public, Archive user mailboxes from one another Exchange server and Office 365. Kernel Migr…

606 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