Multiple OL Inbox in Win98 TaskBar Caused by VB olExp.Active

J

John Gregory

Sub Open_Only_1_Inbox_Not_Two_Or_More_In_Taskbar(
Dim lCount As Lon
Dim olApp As Outlook.Applicatio
Dim olNS As Outlook.NameSpac
Dim olFolder As Outlook.MAPIFolde
Dim olExp As Outlook.Explore
'TEST IF RUNNING & GET RUNNING OL OR NEW O
Set olApp = Nothing 'Var will change only if running
On Error Resume Next 'Err 429 if OL is not runnin
Set olApp = GetObject(, "Outlook.Application"
If olApp Is Nothing Then Set olApp = New Outlook.Applicatio
Set olNS = olApp.GetNamespace("MAPI"
Set olFolder = olNS.GetDefaultFolder(olFolderInbox
Set olExp = olFolder.GetExplore
olExp.Activate 'Makes visible. OL has no Visible property
End Su

I run this procedure from Excel 2000 Visual Basic and it is part of
much larger email procedure. The 1st run of this procedure result
in either one or two instances of OL Inbox in the Windows98 Task Bar
Each subsequent run of this procedure results in one more instances o
an OL Inbox in the Windows98 Taskbar. I want a test so one, but n
more than one instance of OL Inbox is in the Taskbar. I run thi
procedure from an Excel worksheet about five times when it is used

I need the line of code (LOC) "olExp.Activate" because sometime
Outlook is running with no instance of OL Inbox in the Taskbar.
The procudure has worked for about a year as is, but I have to clos
five of six extra instances of the OL Inbox in the Task Bar, which i
only a nuisance, not a critical error. Thanks for any help you ca
give to have OL Inbox in the task bar only one time, not multipl
times

P.S. I have not learned what a poll question is yet. This is my firs
post here
Joh
 
M

Michael Bauer

Hi John,
Set olApp = Nothing 'Var will change only if running.
On Error Resume Next 'Err 429 if OL is not running

At the beginning of the procedure you don't need to set procedure
variables to nothing.
Set olExp = olFolder.GetExplorer
olExp.Activate 'Makes visible. OL has no Visible property.

Check if Application.ActiveExplorer is nothing before opening a new one.
If it?s not then you can use that Explorer and set its CurrentFolder to
the Inbox.
 
J

John Gregory

Michael Bauer, MV

Thanks for the suggestion which is exactly what I needed and had bee
searching for these past few months. Your great suggestion was th
first line below which enables me to test if an "ActiveExplorer" i
activated before I activate another one. I made other changes base
on your advice, but this was the most important item for me

If olApp.ActiveExplorer Is Nothing The
olApp.GetNamespace("MAPI")
.GetDefaultFolder(olFolderInbox)
.GetExplorer.Activat
End I

Joh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top