T
tdk
Dear Group
I have created a new command bar for Word as a VB6 COM addin. In
summary I add an entry to HKEY_CURRENT_USER\Software\Microsoft\Office
\Word\Addins and register my dll. The dll has a sink for the
AddinInstance_OnConnection() event where I create my toolbar like
this...
-----
Set cbBar = oXL.CommandBars.Add(Name:=sToolbarName, Temporary:=False)
cbBar.Position = Registry.RegGetToolbarPosition()
cbBar.Left = Registry.RegGetToolbarLeft()
cbBar.Top = Registry.RegGetToolbarTop()
cbBar.RowIndex = Registry.RegGetToolbarRowIndex()
---
Where oXL is an Application object. I set my toobar position from
registry values and save these vaules to the registry on exit so that
my toolbar can remember its position. One other thing I do is
manipulate the Application.CustomizationContext.Saved so that word
does not write any customisations to Normal.dot.
This all works fantastically well for Word!
Now enter Outlook and using Word as the mail editor. If I start
Outlook before any instances of Word and compose a message (where word
is set to my editor) it all seems to start well. An instance of
Winword.exe starts up and my toolbar loads and positions itself.
If I now start a copy of word it uses the same process Winword.exe
started by Outlook to open word but my toolbar has gone! I don't get a
call into AddinInstance_OnConnection() in these instances. I can
however right click on the toolbar area and get back my command bar
but it apears floating.
It is as though the command bar is started in word mail (WordMail=word
running from outlook) in a way that is incompatible with subsequent
word windows so it doesn't display by default.
I have managed to recognise when the first OnConnection is from
WordMail by looking at the title of the parent of the active window
(not very clean) but knowing we are starting in Outlook doesn't help
me.
Is there a way to
1) Force Word to use a new instance of winword.exe from WordMail.
2) Make the positioning compatible for toolbars started in WordMail or
not WordMail.
3) Not show my toolbar in WordMail and thus prevent it from getting
bad positioning. Simple setting .Visible=False doesn't work it just
hides the toolbar in all instances.
4) Some sort of further macro in word that can be made to bring the
toolbar back when it has been corrupted by WordMail. I assume this
would have to be added to a users Normal.dot - not something I really
want to do but if forced into it I could.
I have also played around with Temporary:=False but it seems to have
little or no affect.
I should note I've been testing on Office 2003 and Office 2000 same
problem in both. Also I've seen this behaviour in other products for
example the SnagIt toolbar so I don't think I'm alone.
It doesn't sound like a big deal but often users open their email
first thing in the morning and leave that open most of the day. Thus
any word docs they open hide my toolbar.
I hope this is enough information - seems like a fairly common problem
- would be great to get it sorted.
I have created a new command bar for Word as a VB6 COM addin. In
summary I add an entry to HKEY_CURRENT_USER\Software\Microsoft\Office
\Word\Addins and register my dll. The dll has a sink for the
AddinInstance_OnConnection() event where I create my toolbar like
this...
-----
Set cbBar = oXL.CommandBars.Add(Name:=sToolbarName, Temporary:=False)
cbBar.Position = Registry.RegGetToolbarPosition()
cbBar.Left = Registry.RegGetToolbarLeft()
cbBar.Top = Registry.RegGetToolbarTop()
cbBar.RowIndex = Registry.RegGetToolbarRowIndex()
---
Where oXL is an Application object. I set my toobar position from
registry values and save these vaules to the registry on exit so that
my toolbar can remember its position. One other thing I do is
manipulate the Application.CustomizationContext.Saved so that word
does not write any customisations to Normal.dot.
This all works fantastically well for Word!
Now enter Outlook and using Word as the mail editor. If I start
Outlook before any instances of Word and compose a message (where word
is set to my editor) it all seems to start well. An instance of
Winword.exe starts up and my toolbar loads and positions itself.
If I now start a copy of word it uses the same process Winword.exe
started by Outlook to open word but my toolbar has gone! I don't get a
call into AddinInstance_OnConnection() in these instances. I can
however right click on the toolbar area and get back my command bar
but it apears floating.
It is as though the command bar is started in word mail (WordMail=word
running from outlook) in a way that is incompatible with subsequent
word windows so it doesn't display by default.
I have managed to recognise when the first OnConnection is from
WordMail by looking at the title of the parent of the active window
(not very clean) but knowing we are starting in Outlook doesn't help
me.
Is there a way to
1) Force Word to use a new instance of winword.exe from WordMail.
2) Make the positioning compatible for toolbars started in WordMail or
not WordMail.
3) Not show my toolbar in WordMail and thus prevent it from getting
bad positioning. Simple setting .Visible=False doesn't work it just
hides the toolbar in all instances.
4) Some sort of further macro in word that can be made to bring the
toolbar back when it has been corrupted by WordMail. I assume this
would have to be added to a users Normal.dot - not something I really
want to do but if forced into it I could.
I have also played around with Temporary:=False but it seems to have
little or no affect.
I should note I've been testing on Office 2003 and Office 2000 same
problem in both. Also I've seen this behaviour in other products for
example the SnagIt toolbar so I don't think I'm alone.
It doesn't sound like a big deal but often users open their email
first thing in the morning and leave that open most of the day. Thus
any word docs they open hide my toolbar.
I hope this is enough information - seems like a fairly common problem
- would be great to get it sorted.