Discussion:
Outlook blocks Word add-in :-(
(too old to reply)
Flemming Dahl
2005-12-22 17:05:02 UTC
Permalink
Hi all

Help is very much needed here:

I have created a word.dot file and placed it in Words Startup folder. When I
open Word the add-in reads some files, adds a new menuitem in word, and it
all works fine.

When it goes very bad:
- Start my pc
- Open Outlook2003 (using Word as email editor)
I can now see that a WINWORD.EXE session is opened on the pc, and that my
add-in is opened as well
- Open Word and nothing happens

It seems like Outlook opens my Word Add-in with out running the AutoExec and
AutoOpen...
and when I open Word it seems like Word says - oh the add-in file is already
opened by Word (the Outlook session) so Word does not run the AutoExec and
AutoOpen.


I don't my amount of spend time here - PLEASE help me get a solution here or
to report the posible "bug" to Microsoft.

Thanks
Flemming, Denmark

Posted both in microsoft.public.outlook.program_addins and
microsoft.public.word.vba.addins
Doug Robbins - Word MVP
2005-12-24 10:46:12 UTC
Permalink
It's a problem that we all face. The only way around it is to start/have
your users start Word FIRST.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
Post by Flemming Dahl
Hi all
I have created a word.dot file and placed it in Words Startup folder. When
I open Word the add-in reads some files, adds a new menuitem in word, and
it all works fine.
- Start my pc
- Open Outlook2003 (using Word as email editor)
I can now see that a WINWORD.EXE session is opened on the pc, and that
my add-in is opened as well
- Open Word and nothing happens
It seems like Outlook opens my Word Add-in with out running the AutoExec
and AutoOpen...
and when I open Word it seems like Word says - oh the add-in file is
already opened by Word (the Outlook session) so Word does not run the
AutoExec and AutoOpen.
I don't my amount of spend time here - PLEASE help me get a solution here
or to report the posible "bug" to Microsoft.
Thanks
Flemming, Denmark
Posted both in microsoft.public.outlook.program_addins and
microsoft.public.word.vba.addins
Flemming Dahl
2005-12-24 11:28:28 UTC
Permalink
Thank you for your reply Doug.

I had hoped for a better solution than "It's a bug in MS Office".

Do you know if it is reportet to Microsoft? or where to do so?

Thanks,
Flemming
Post by Doug Robbins - Word MVP
It's a problem that we all face. The only way around it is to start/have
your users start Word FIRST.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
Post by Flemming Dahl
Hi all
I have created a word.dot file and placed it in Words Startup folder.
When I open Word the add-in reads some files, adds a new menuitem in
word, and it all works fine.
- Start my pc
- Open Outlook2003 (using Word as email editor)
I can now see that a WINWORD.EXE session is opened on the pc, and that
my add-in is opened as well
- Open Word and nothing happens
It seems like Outlook opens my Word Add-in with out running the AutoExec
and AutoOpen...
and when I open Word it seems like Word says - oh the add-in file is
already opened by Word (the Outlook session) so Word does not run the
AutoExec and AutoOpen.
I don't my amount of spend time here - PLEASE help me get a solution here
or to report the posible "bug" to Microsoft.
Thanks
Flemming, Denmark
Posted both in microsoft.public.outlook.program_addins and
microsoft.public.word.vba.addins
Doug Robbins - Word MVP
2005-12-24 20:58:25 UTC
Permalink
Rather than being a bug, I believe that it is "by design", related to
security issues - Damn Virus Kiddies.

See the Knowledge Base Article at
http://support.microsoft.com/kb/286310/en-us
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
Post by Flemming Dahl
Thank you for your reply Doug.
I had hoped for a better solution than "It's a bug in MS Office".
Do you know if it is reportet to Microsoft? or where to do so?
Thanks,
Flemming
Post by Doug Robbins - Word MVP
It's a problem that we all face. The only way around it is to start/have
your users start Word FIRST.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
Post by Flemming Dahl
Hi all
I have created a word.dot file and placed it in Words Startup folder.
When I open Word the add-in reads some files, adds a new menuitem in
word, and it all works fine.
- Start my pc
- Open Outlook2003 (using Word as email editor)
I can now see that a WINWORD.EXE session is opened on the pc, and that
my add-in is opened as well
- Open Word and nothing happens
It seems like Outlook opens my Word Add-in with out running the AutoExec
and AutoOpen...
and when I open Word it seems like Word says - oh the add-in file is
already opened by Word (the Outlook session) so Word does not run the
AutoExec and AutoOpen.
I don't my amount of spend time here - PLEASE help me get a solution
here or to report the posible "bug" to Microsoft.
Thanks
Flemming, Denmark
Posted both in microsoft.public.outlook.program_addins and
microsoft.public.word.vba.addins
Flemming Dahl
2005-12-24 22:40:54 UTC
Permalink
You might be right - and yes - Damn Virus Kiddies.

Couldn't I make a add-in for outlook to start Adds a menuitem to the hidden
Word session, so that when word is started the menuitem can be found, at the
word add-in will provide the codebehind ?

.... any comments on that idea?
Post by Doug Robbins - Word MVP
Rather than being a bug, I believe that it is "by design", related to
security issues - Damn Virus Kiddies.
See the Knowledge Base Article at
http://support.microsoft.com/kb/286310/en-us
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
Post by Flemming Dahl
Thank you for your reply Doug.
I had hoped for a better solution than "It's a bug in MS Office".
Do you know if it is reportet to Microsoft? or where to do so?
Thanks,
Flemming
Post by Doug Robbins - Word MVP
It's a problem that we all face. The only way around it is to
start/have your users start Word FIRST.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
Post by Flemming Dahl
Hi all
I have created a word.dot file and placed it in Words Startup folder.
When I open Word the add-in reads some files, adds a new menuitem in
word, and it all works fine.
- Start my pc
- Open Outlook2003 (using Word as email editor)
I can now see that a WINWORD.EXE session is opened on the pc, and
that my add-in is opened as well
- Open Word and nothing happens
It seems like Outlook opens my Word Add-in with out running the
AutoExec and AutoOpen...
and when I open Word it seems like Word says - oh the add-in file is
already opened by Word (the Outlook session) so Word does not run the
AutoExec and AutoOpen.
I don't my amount of spend time here - PLEASE help me get a solution
here or to report the posible "bug" to Microsoft.
Thanks
Flemming, Denmark
Posted both in microsoft.public.outlook.program_addins and
microsoft.public.word.vba.addins
Doug Robbins - Word MVP
2005-12-25 07:06:56 UTC
Permalink
I suggest that you ask that question in an Outlook newsgroup.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
Post by Flemming Dahl
You might be right - and yes - Damn Virus Kiddies.
Couldn't I make a add-in for outlook to start Adds a menuitem to the
hidden Word session, so that when word is started the menuitem can be
found, at the word add-in will provide the codebehind ?
.... any comments on that idea?
Post by Doug Robbins - Word MVP
Rather than being a bug, I believe that it is "by design", related to
security issues - Damn Virus Kiddies.
See the Knowledge Base Article at
http://support.microsoft.com/kb/286310/en-us
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
Post by Flemming Dahl
Thank you for your reply Doug.
I had hoped for a better solution than "It's a bug in MS Office".
Do you know if it is reportet to Microsoft? or where to do so?
Thanks,
Flemming
Post by Doug Robbins - Word MVP
It's a problem that we all face. The only way around it is to
start/have your users start Word FIRST.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
Post by Flemming Dahl
Hi all
I have created a word.dot file and placed it in Words Startup folder.
When I open Word the add-in reads some files, adds a new menuitem in
word, and it all works fine.
- Start my pc
- Open Outlook2003 (using Word as email editor)
I can now see that a WINWORD.EXE session is opened on the pc, and
that my add-in is opened as well
- Open Word and nothing happens
It seems like Outlook opens my Word Add-in with out running the
AutoExec and AutoOpen...
and when I open Word it seems like Word says - oh the add-in file is
already opened by Word (the Outlook session) so Word does not run the
AutoExec and AutoOpen.
I don't my amount of spend time here - PLEASE help me get a solution
here or to report the posible "bug" to Microsoft.
Thanks
Flemming, Denmark
Posted both in microsoft.public.outlook.program_addins and
microsoft.public.word.vba.addins
Jonathan West
2005-12-26 15:34:21 UTC
Permalink
A sDoug as said, this is annoying but the way Word & Outlook work together.
If you are using Word as the email editor for outlook, then you cannot
assume that the AutoExec macro in a Word Add-in will fire.

Once you accept this as expected behavior, then the nature of the necessary
workaround is fairly straightforward. If your add-in has any user interface
items, then any macros triggered by them must first check to see if AutoExec
has been run (you can have it set a public Boolean variable when AutoExec
has finished), and run it immediately if it has not been run.
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Post by Flemming Dahl
Hi all
I have created a word.dot file and placed it in Words Startup folder. When
I open Word the add-in reads some files, adds a new menuitem in word, and
it all works fine.
- Start my pc
- Open Outlook2003 (using Word as email editor)
I can now see that a WINWORD.EXE session is opened on the pc, and that
my add-in is opened as well
- Open Word and nothing happens
It seems like Outlook opens my Word Add-in with out running the AutoExec
and AutoOpen...
and when I open Word it seems like Word says - oh the add-in file is
already opened by Word (the Outlook session) so Word does not run the
AutoExec and AutoOpen.
I don't my amount of spend time here - PLEASE help me get a solution here
or to report the posible "bug" to Microsoft.
Thanks
Flemming, Denmark
Posted both in microsoft.public.outlook.program_addins and
microsoft.public.word.vba.addins
Flemming Dahl
2005-12-26 20:58:40 UTC
Permalink
Hi Jonathan

Thanks for your participation on this issue - and I see your point - but...

AutoExec fires a macro that adds a new menuitem next right next to the
"Help" menu item in Word.

When AutoExec have not been fired the menuitem have not been created... =>
nothing to press => no way to check a boolean.


Regards,
Flemming
Post by Jonathan West
A sDoug as said, this is annoying but the way Word & Outlook work together.
If you are using Word as the email editor for outlook, then you cannot
assume that the AutoExec macro in a Word Add-in will fire.
Once you accept this as expected behavior, then the nature of the
necessary workaround is fairly straightforward. If your add-in has any
user interface items, then any macros triggered by them must first check
to see if AutoExec has been run (you can have it set a public Boolean
variable when AutoExec has finished), and run it immediately if it has not
been run.
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Post by Flemming Dahl
Hi all
I have created a word.dot file and placed it in Words Startup folder.
When I open Word the add-in reads some files, adds a new menuitem in
word, and it all works fine.
- Start my pc
- Open Outlook2003 (using Word as email editor)
I can now see that a WINWORD.EXE session is opened on the pc, and that
my add-in is opened as well
- Open Word and nothing happens
It seems like Outlook opens my Word Add-in with out running the AutoExec
and AutoOpen...
and when I open Word it seems like Word says - oh the add-in file is
already opened by Word (the Outlook session) so Word does not run the
AutoExec and AutoOpen.
I don't my amount of spend time here - PLEASE help me get a solution here
or to report the posible "bug" to Microsoft.
Thanks
Flemming, Denmark
Posted both in microsoft.public.outlook.program_addins and
microsoft.public.word.vba.addins
Jonathan West
2005-12-27 14:05:43 UTC
Permalink
Post by Flemming Dahl
Hi Jonathan
Thanks for your participation on this issue - and I see your point - but...
AutoExec fires a macro that adds a new menuitem next right next to the
"Help" menu item in Word.
When AutoExec have not been fired the menuitem have not been created... =>
nothing to press => no way to check a boolean.
Oh, I've had a similar problem - a dynamic menu that needed to be built on
loading the add-in. There's a workaround for that. Place an ordinary
commandbarbutton on the menu. Set its ActionControl property to a macro that
replaces the button with the menu you want and then performs the Execute
method on the menu to drop it down. The user will have no idea that what he
has just clicked was originally a button that has disappeared and turned
into a menu.
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Flemming Dahl
2005-12-27 19:13:52 UTC
Permalink
Hi Jonathan

Thanks A LOT - I belive this solution will work-a-round the Outlook issue of
MS Office (sorry Ken)

Thanks
Flemming
Post by Jonathan West
Post by Flemming Dahl
Hi Jonathan
Thanks for your participation on this issue - and I see your point - but...
AutoExec fires a macro that adds a new menuitem next right next to the
"Help" menu item in Word.
When AutoExec have not been fired the menuitem have not been created...
=> nothing to press => no way to check a boolean.
Oh, I've had a similar problem - a dynamic menu that needed to be built on
loading the add-in. There's a workaround for that. Place an ordinary
commandbarbutton on the menu. Set its ActionControl property to a macro
that replaces the button with the menu you want and then performs the
Execute method on the menu to drop it down. The user will have no idea
that what he has just clicked was originally a button that has disappeared
and turned into a menu.
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Flemming Dahl
2005-12-29 21:12:26 UTC
Permalink
Hi Jonathan

What am I doing wrong here...

When I want to delete CommandBarButton my code fails like this:
Run-time error '-214746729(80004005)':
Method 'Delete' of object '_CommandBartButton' failed

It seems like the CommandBarButton is active and can't be deleted...

How do you make it work?

Like this???
cbbJWest.Visible = False
ThisDocument.Saved = True

or how???


This is my code:

Private mcbMenu As CommandBar
Private Const msMY_MENU_NAME As String = "&SuperItWorks"

Public Sub JWestMenuItem()
Dim cbbJWest As CommandBarButton

Set mcbMenu = CommandBars.ActiveMenuBar
Set cbbJWest= mcbMenu.Controls(Replace(msMY_MENU_NAME, "&", ""))
'mcbMenu.Controls(mcbMenu.Controls(cbbJWest.Caption).Index - 1).SetFocus
cbbJWest.Delete

AutoExec

' CleanUp
Set cbbJWest= Nothing
Set mcbMenu = Nothing
End Sub
Ken Slovak - [MVP - Outlook]
2005-12-30 14:33:35 UTC
Permalink
At least with Outlook using WordMail, some properties and methods of a
button object aren't usable even though the button works and returns some
properties and fires the Click event.

What has worked for me in those cases (.Delete, .PasteFace, etc.) is to
reinstantiate the button using FindControl as a new, locally declared button
object within my cleanup procedure and calling .Delete on that locally
declared button object.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
Post by Flemming Dahl
Hi Jonathan
What am I doing wrong here...
Method 'Delete' of object '_CommandBartButton' failed
It seems like the CommandBarButton is active and can't be deleted...
How do you make it work?
Like this???
cbbJWest.Visible = False
ThisDocument.Saved = True
or how???
Private mcbMenu As CommandBar
Private Const msMY_MENU_NAME As String = "&SuperItWorks"
Public Sub JWestMenuItem()
Dim cbbJWest As CommandBarButton
Set mcbMenu = CommandBars.ActiveMenuBar
Set cbbJWest= mcbMenu.Controls(Replace(msMY_MENU_NAME, "&", ""))
'mcbMenu.Controls(mcbMenu.Controls(cbbJWest.Caption).Index - 1).SetFocus
cbbJWest.Delete
AutoExec
' CleanUp
Set cbbJWest= Nothing
Set mcbMenu = Nothing
End Sub
Flemming Dahl
2005-12-30 23:21:50 UTC
Permalink
Hi Ken

I have made lots of add-ins to both Word and Excel - never to Outlook, since
my company have been using Lotus Notes until now.

If I can solve it within Word I would prefer so - there is also the
installation on 6000 pc world wide to take in consideration before changing
anything that's working.

So my decision for now is - make it within Word.

I have added the following code into my AutoExec

Dim cbbTempButton As CommandBarButton

Set mcbMenu = CommandBars.ActiveMenuBar
Set cbbTempButton = mcbMenu.Controls(Replace(msMY_MENU_NAME, "&", ""))
With cbbTempButton
.Visible = False
.Caption = "SO_Hidden"
End With
ThisDocument.Saved = True

I have made another sub that is called by my "temp" button, and that sub
calles the AutoExec

This have only one disadvantage - first time the user opens Word he/she have
to press the menuitem twice which could be 6000 clicks world wide. If
Outlook stays open the rest of the day, then Word will also be open...
giving no more extra clicks - if not there could be more extra clicks.
This part I don't like.

Cheers,
Flemming
Jonathan West
2005-12-31 22:07:28 UTC
Permalink
Hi Flemming,

Don't bother to delete it, just set its Visible property to False.
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Post by Flemming Dahl
Hi Jonathan
What am I doing wrong here...
Method 'Delete' of object '_CommandBartButton' failed
It seems like the CommandBarButton is active and can't be deleted...
How do you make it work?
Like this???
cbbJWest.Visible = False
ThisDocument.Saved = True
or how???
Private mcbMenu As CommandBar
Private Const msMY_MENU_NAME As String = "&SuperItWorks"
Public Sub JWestMenuItem()
Dim cbbJWest As CommandBarButton
Set mcbMenu = CommandBars.ActiveMenuBar
Set cbbJWest= mcbMenu.Controls(Replace(msMY_MENU_NAME, "&", ""))
'mcbMenu.Controls(mcbMenu.Controls(cbbJWest.Caption).Index - 1).SetFocus
cbbJWest.Delete
AutoExec
' CleanUp
Set cbbJWest= Nothing
Set mcbMenu = Nothing
End Sub
Flemming Dahl
2006-01-01 16:21:55 UTC
Permalink
That's the right answer Jonathan... cause the CommandBarButton can not be
deleted as I see it.

Thanks for your help - I got a good solution

Happy new year
Flemming - MVP wannabe

Ken Slovak - [MVP - Outlook]
2005-12-27 14:20:55 UTC
Permalink
If it's a WordMail item (Window.EnvelopeVisible = True) then you would get
an Outlook NewInspector event from the Inspectors collection each time a new
email was opened. Using that event you can check for Inspector.IsWordMail =
True to verify the item is using WordMail. Then you can add your button to
whatever CustomizationContext you choose.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
Post by Flemming Dahl
Hi Jonathan
Thanks for your participation on this issue - and I see your point - but...
AutoExec fires a macro that adds a new menuitem next right next to the
"Help" menu item in Word.
When AutoExec have not been fired the menuitem have not been created... =>
nothing to press => no way to check a boolean.
Regards,
Flemming
Post by Jonathan West
A sDoug as said, this is annoying but the way Word & Outlook work
together. If you are using Word as the email editor for outlook, then you
cannot assume that the AutoExec macro in a Word Add-in will fire.
Once you accept this as expected behavior, then the nature of the
necessary workaround is fairly straightforward. If your add-in has any
user interface items, then any macros triggered by them must first check
to see if AutoExec has been run (you can have it set a public Boolean
variable when AutoExec has finished), and run it immediately if it has
not been run.
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Flemming Dahl
2005-12-27 19:09:28 UTC
Permalink
Hi Ken

I can not be sure that the user will write a mail before opening Word, but I
can use the (Window.EnvelopeVisible = True) to ensure that my menu do not
work if it's a WordMail item.

Thanks
Flemming
Post by Ken Slovak - [MVP - Outlook]
If it's a WordMail item (Window.EnvelopeVisible = True) then you would get
an Outlook NewInspector event from the Inspectors collection each time a
new email was opened. Using that event you can check for
Inspector.IsWordMail = True to verify the item is using WordMail. Then you
can add your button to whatever CustomizationContext you choose.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
Jim
2005-12-28 17:44:44 UTC
Permalink
Post by Jonathan West
A sDoug as said, this is annoying but the way Word & Outlook work together.
If you are using Word as the email editor for outlook, then you cannot
assume that the AutoExec macro in a Word Add-in will fire.
Once you accept this as expected behavior, then the nature of the necessary
workaround is fairly straightforward. If your add-in has any user interface
items, then any macros triggered by them must first check to see if AutoExec
has been run (you can have it set a public Boolean variable when AutoExec
has finished), and run it immediately if it has not been run.
Are you still having issues, I can show you my code which was recommend
by Ken that will remove the commandvar in outlook but re-add it in Word.
Rog
Flemming Dahl
2005-12-29 08:56:34 UTC
Permalink
Thanks - Ken have given me links to his code.
Post by Jonathan West
A sDoug as said, this is annoying but the way Word & Outlook work
together. If you are using Word as the email editor for outlook, then you
cannot assume that the AutoExec macro in a Word Add-in will fire.
Once you accept this as expected behavior, then the nature of the
necessary workaround is fairly straightforward. If your add-in has any
user interface items, then any macros triggered by them must first check
to see if AutoExec has been run (you can have it set a public Boolean
variable when AutoExec has finished), and run it immediately if it has
not been run.
Are you still having issues, I can show you my code which was recommend by
Ken that will remove the commandvar in outlook but re-add it in Word.
Rog
Jonathan West
2005-12-28 21:29:44 UTC
Permalink
Post by Jonathan West
A sDoug as said, this is annoying but the way Word & Outlook work
together. If you are using Word as the email editor for outlook, then you
cannot assume that the AutoExec macro in a Word Add-in will fire.
Once you accept this as expected behavior, then the nature of the
necessary workaround is fairly straightforward. If your add-in has any
user interface items, then any macros triggered by them must first check
to see if AutoExec has been run (you can have it set a public Boolean
variable when AutoExec has finished), and run it immediately if it has
not been run.
Are you still having issues, I can show you my code which was recommend by
Ken that will remove the commandvar in outlook but re-add it in Word.
Rog
I have a workaround that works for me, but I'm always interested in learning
of new or alternative approaches that might work even better. By all means
post the code!
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Loading...