Addin doesn't create button 0n startup if Outlook still in memory after closing

M

Mike

I noticed that if an Outlook user opens a secondary window in Outlook such as the Calendar
and then quits Outlook by closing the main Outlook window then Outlook remains in memory
as proven by task manager.

This is preventing my code that creates a toolbar button on startup from creating a button
on the Standard toolbar.

In InitHandler.....

If Not objOutlook.ActiveExplorer Is Nothing Then
If objMainButton Is Nothing Then
Set objMainButton = objMainCommandBar.Controls.Add(, , , , True)
With objMainButton
.BeginGroup = True
.FaceId = 794
.Caption = "MyButton"
.Tag = "Blah Blah"
.Style = msoButtonIconAndCaption
End With
End If
End If


What is the best way to handle this?

-mike
 
K

Ken Slovak - [MVP - Outlook]

If Outlook is still running there's nothing you can do because your addin
will only get started when Outlook gets started.

If you are asking how to handle a situation where Outlook is started in
"headless" mode (where there is no UI) then obviously you can't expect an
ActiveExplorer in that case. You can test for Explorers.Count > 0 and if
true get a handle to Explorers.Item(1), or your code can subscribe to
NewExplorer() and activate when that fires.

But if users don't truly close Outlook there isn't much you can do.




I noticed that if an Outlook user opens a secondary window in Outlook such
as the Calendar
and then quits Outlook by closing the main Outlook window then Outlook
remains in memory
as proven by task manager.

This is preventing my code that creates a toolbar button on startup from
creating a button
on the Standard toolbar.

In InitHandler.....

If Not objOutlook.ActiveExplorer Is Nothing Then
If objMainButton Is Nothing Then
Set objMainButton = objMainCommandBar.Controls.Add(, , , , True)
With objMainButton
.BeginGroup = True
.FaceId = 794
.Caption = "MyButton"
.Tag = "Blah Blah"
.Style = msoButtonIconAndCaption
End With
End If
End If


What is the best way to handle this?

-mike
 
M

Mike

Ken Slovak - said:
If Outlook is still running there's nothing you can do because your addin
will only get started when Outlook gets started.

If you are asking how to handle a situation where Outlook is started in
"headless" mode (where there is no UI) then obviously you can't expect an
ActiveExplorer in that case. You can test for Explorers.Count > 0 and if
true get a handle to Explorers.Item(1), or your code can subscribe to
NewExplorer() and activate when that fires.

But if users don't truly close Outlook there isn't much you can do.

Thanks Ken. I think a proper FAQ for my users may be the best solution atthis point.

I also suspect other addins such as Skype and iTunes may be the culprit as well.

-mike
 
K

Ken Slovak - [MVP - Outlook]

Various versions of those addins, among others, are known to cause problems.
In addition synch applications for various devices will also keep Outlook
running in many cases.




<snip>
Thanks Ken. I think a proper FAQ for my users may be the best solution at
this point.

I also suspect other addins such as Skype and iTunes may be the culprit as
well.

-mike
 
M

Mike

Ken Slovak - said:
Various versions of those addins, among others, are known to cause problems.
In addition synch applications for various devices will also keep Outlook
running in many cases.

True and to add to the list there is Winfax and also mailbox notifier tools that sit in
the tray.

-mike
 

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