My Outlook button appears in Word!

R

regify

Hi,

I developed a Outlook COM AddIn using VB6 with Office 2000 to 2003
SP3). The user should be able to click a button that is placed on a
custom temporary CommandBar. I save and restore the position and state
of this CommandBar using .Type, .Left, .Top, .Visible, .RowIndex
and .Width properties. If Outlook is used as mail-editor, everything
is really fine. But most people seem to use Word as Editor and the
problem starts here.

Problem 1:
The CommandBar position switches. If I set my CommandBar second to the
menubar, the RowIndex returns me 4 as position (strange). If I set
RowIndex to 4 in a later call, after opening a new inspector, my
CommandBar slips to a far lower position and random left position.

Problem 2:
In some situations, my commandbar appears in Word! If someone klicks,
this obviously triggers some bad errors. I really created only an
Outlook AddIn and I ensure that Inspector.CurrentItem.Class is of type
olMail before. How to prevent the appearance in Word!

Redemption-Objects are available and used.

Can someone please help? My customers complain about this behaviour
and I'm running out of ideas to prevent :-(

Kukulkan
 
R

regify

Hi,

I found a tip that suggested to write a Word AddIn to search for my
custom CommandBar and removing it from the Word interface. I wrote
such an addin, but it removes the buttom from Outlook Inspector, too!
I'm going crazy. How to know if I'm in Word or in Outlook mail-
inspector?

Kukulkan
 
K

Ken Slovak - [MVP - Outlook]

You do not need a separate Word addin. In your Outlook addin if you discover
that the window is using WordMail you instantiate a Word.Application object
declared WithEvents. Then you handle the WindowActivate event. If the
Envelope.Visible property is true on the window passed to you in
WindowActivate then it's a WordMail window, if that property is false it's a
Word document.

Knowing that you can then hide or show your UI as appropriate.
 
R

regify

Hi Ken,
You do not need a separate Word addin. In your Outlook addin if you discover
that the window is using WordMail you instantiate a Word.Application object
declared WithEvents. Then you handle the WindowActivate event. If the
Envelope.Visible property is true on the window passed to you in
WindowActivate then it's a WordMail window, if that property is false it's a
Word document.

Whow, this worked perfectly. Needed some additional work, because this
does not work with OL2000, but managed to run. Thank you.

Is there a solution for Problem 1, too? If I have Word as editor it
seem to be impossible to reproduce the CommandBar position in a
reliable way. Sometimes, another CommandBar, that have been in the
same row before, is pushed down one row after inserting my own
CommandBar. Other situations, the button has been placed on top of the
"Send" CommandBar, and after restauration it is below the "Send"
CommandBar.

Any solution for this, too?

Kukulkan
 
K

Ken Slovak - [MVP - Outlook]

No solution for that problem that I've ever found. It can happen with the
Outlook editor also, you know. If an addin that gets initialized before
yours claims that spot in the UI yours get placed somewhere else no matter
what position settings you call for. Not much you can do about it.
 

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