Adding a new toolbar only when we open the new mail message window

K

kishore

I was trying to add a new tool bar when we compose a mail
and also trying to customize my new toolbar to
automatically contain some already exiting command buttons
using com addin.
I.e. I wanna write a COM add-in to OutLook that adds a new
toolbar to the OutLook's Toolbar.
This tool bar should apear only in new mail window.

There are two commands(buttons) by name "Digitally sign
Message" and "Encrypt Message Contents and Attachments".

These are present in the Tools -> Customize -> Commands ->
In categories select Standard -> on the Right side, if you
scroll down you can see commands(buttons) by
name "Digitally sign Message" and "Encrypt Message
Contents and Attachments".

On the whole, what i am trying for is , placing the above
two commands on my new toolbar that i will create using
com addin.

So, . These buttons are already present in the standard
command bar (This buttons will come only when you try to
customize the tool bar of new mail). We need to add this
Digitally sign message and Encrypt message contents and
Att…. Buttons to the outlook programmatically using some
com addin or some other technology.

The buttons should appear on their own toolbar in the
Wordmail or Outlook message entry windows.

There are two different email-editing solutions in
Outlook -Mail Editor and Wordmail.

Since this code calls the Outlook Sign and Encrypt
functions it can be a standalone object (not connected to
any other module) and should not have any dependencies
besides Outlook.

Could you please help in on writing a com addin or some
macro where it will create a new commandbar and will place
these two buttons on that new command bar.

Please do help me in this regard and thank you in advance
for the help.
 
E

Eric Legault [MVP - Outlook]

It looks like when you set a reference to those two CommandBarButtons using
ID's (718 & 719), and try the Copy method to a new CommandBar, the buttons
are not visible and changing the Visible property to True does nothing!
Those buttons aren't available using the Toolbar Customize dialog either.
It looks like you'd have to:

- create two command bar buttons on a new command bar in the Inspector_Open
event
- create two procedures that grabs these buttons and executes them (sounds
drastic!)
- assign those procedures to be run by your new command bar buttons in step
1 by using the OnAction property
 
K

kishore1021

Hi,
Thanks a lot for your help. I had tried doing some R & D and was
unable to get any result. Could you please send me a sample code ateast
for one button so that i will do for the rest and also do some
customization.


Thank you

Kishore
 
G

Guest

Hi,
Thanks for your help. Could you please send me some sample
VB com Addin Code that does what you have mentioned
atleast for one button.

Thanks in advance
 
E

Eric Legault [MVP - Outlook]

Here's an article on programming command bars in Outlook:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnofftalk/html/office05022002.asp

And here's a great collection of information on COM Add-Ins:
http://www.slipstick.com/dev/comaddins.htm

The above pages contain plenty of sample code that could help you solve your
problem.

BTW, if that was you who sent me an e-mail with the 2MB Word attachment: I
do not respond to e-mail requests for assistance. Please conduct all
conversations in this newsgroup only.
 
K

kishore1021

Commandbar not getting added to inspector when word is used as editor
Hi,
I have written a Com Add-in which adds a new Commandbar to the New Mai
window. I am using the NewInspector event to place a Commandbar wit
buttons on a new mail Inspector window , I.e. Whenever New Mail messag
window is opened. I have created a new commandbar and aded a ne
commandbutton on that newly created commandbar.

Everything is working fine if i use HTML as mail editor. If i use wor
as the default mail editor in outlook, then the commandbar is no
getting added and also the buttons.

Could someone please suggest me what i should do to add the commandbar
to the word mail editor when i open the new mail window.

I.e when I create a New mail message using MS Word mail editor option
what should i do to add my owm custom bar.

Thank
 
E

Eric Legault [MVP - Outlook]

The NewInspector event does not fire when Word is used as the e-mail editor.
You'd have to write additional code to run in the Word environment (a macro
in normal.dot) to create toolbars there.
 
K

kishore1021

HI,
you have mentioned that
The NewInspector event does not fire when Word is used as the e-mail
editor.
I think the new inspector event is still fired from outlook even though
i use word as the mail editor in outlook.

I have written code to identify whether the editor is word or HTML and
i am copying a small portion of it below.


Set objInsp = Inspector
Set objItem = objInsp.CurrentItem

If objInsp.IsWordMail Then
MsgBox "word mail"
Set WordDoc = objInsp.WordEditor
MsgBox "You are opening the new mail which is using word as mail
editor"

But after this, i am not able to add the outlook commands to this word
as i have read that the word document object is getting opened here.

as i mentioned earlier that i am adding the outlook command buttons
already present. They are "Digitally sign message" and "Encrypt message
contents and Att…". I have also mentioned where these buttons are
present. They have ID of 718 and 719. So, can we add them to word?? If
so, could you suggest me some way of doing it ??

You said that i have to write additional code to run in the Word
environment (a macro in normal.dot) to create toolbars there. Could you
please send me some information on this ??

Thanks
 
K

kishore1021

HI,
you have mentioned that
The NewInspector event does not fire when Word is used as the e-mail
editor.
I think the new inspector event is still fired from outlook even though
i use word as the mail editor in outlook.

I have written code to identify whether the editor is word or HTML and
i am copying a small portion of it below.


Set objInsp = Inspector
Set objItem = objInsp.CurrentItem

If objInsp.IsWordMail Then
MsgBox "word mail"
Set WordDoc = objInsp.WordEditor
MsgBox "You are opening the new mail which is using word as mail
editor"

But after this, i am not able to add the outlook commands to this word
as i have read that the word document object is getting opened here.

as i mentioned earlier that i am adding the outlook command buttons
already present. They are "Digitally sign message" and "Encrypt message
contents and Att…". I have also mentioned where these buttons are
present. They have ID of 718 and 719. So, can we add them to word?? If
so, could you suggest me some way of doing it ??

You said that i have to write additional code to run in the Word
environment (a macro in normal.dot) to create toolbars there. Could you
please send me some information on this ??

Thanks
 
K

Ken Slovak - [MVP - Outlook]

See the answers in one of the other threads you started on the same
topic in other groups.
 
E

Eric Legault [MVP - Outlook]

No, you cannot add Outlook command bars or buttons to Word using your code
in Outlook. You have to create your code to create custom toolbars within
Word (put the code in normal.dot), and have it run either all of the time or
when you detect that a Word Mail item is being used (you'd have to manage
some kind of state information set in your Outlook code, and detected in
your Word code to do that).

For support with Word VBA, please consult the microsoft.public.word.vba*
newsgroups.
 

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