A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Adding a button when using word to display rtf messages fails



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 9th 06, 03:32 PM posted to microsoft.public.outlook.program_addins
james
external usenet poster
 
Posts: 8
Default Adding a button when using word to display rtf messages fails

Hi All,

I'm attempting to add a button (or any other control!) to the inspector
when displaying messages.

The sample below can be executed, and it will add a toolbar and button
in 3 out of 4 cases.

Works for message composition, both with word-as-editor enabled and
disabled.
Works for message display, not using word for RTF.
Fails when using word to display RTF messages. (Outlook | Tools |
Options | MailFormat | Use Microsoft Office 2003 to read Rich Text
e-mail messages)

A discussion in another forum alluded to Word being used in a mode
whereby its command bars are read only. Is there any basis to this?
I also noticed that Outlook Spy (2.10.0.352) doesn't load its command
bar when word is used to display an RTF message.

I have also tried navigating to the wordDoc CommandBars, and tried (a)
adding a new CommandBar, and (b) adding a new button to an existing
CommandBar, but eventually get the same result in both cases on
attempting to add the new control.

Using Outlook 2003 SP1.

Does anyone have any ideas? Or is it time to give up, and look for some
other way to display message status info to the user?

' Sample code to work out why can't add button to Outlook Word RTF
viewer
' Doesn't work when Outlook set up to use Word to view RTF messages
' Throws error: "Method 'Add' of _CommandBars failed" ErrorID
0x80004005
' Works in other cases
' a) compose using word editor
' b) compose using rtf(?) editor
' c) display using rtf(?) viewer

Option Explicit

Dim WithEvents objInspectors As Outlook.Inspectors
Dim WithEvents objInspector As Outlook.Inspector
Dim objCommandBar As office.CommandBar
Dim objCommandBarCtrl As office.CommandBarButton

Private Sub Application_Quit()
Set objInspectors = Nothing
End Sub

Private Sub Application_Startup()
Set objInspectors = Application.Inspectors
End Sub

Private Sub objInspector_Close()
Set objCommandBarCtrl = Nothing
Set objCommandBar = Nothing
Set objInspector = Nothing
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
Set objInspector = Inspector
' fails on the following line
Set objCommandBar = objInspector.CommandBars.Add("Hello",
office.msoBarTop, True, True)
objCommandBar.Enabled = True
objCommandBar.Visible = True

Set objCommandBarCtrl =
objCommandBar.Controls.Add(office.msoControlButton )
objCommandBarCtrl.Style = msoButtonCaption
objCommandBarCtrl.Visible = True
objCommandBarCtrl.Enabled = True
objCommandBarCtrl.Caption = "World!"
End Sub

  #2  
Old August 11th 06, 12:14 PM posted to microsoft.public.outlook.program_addins
james
external usenet poster
 
Posts: 8
Default Adding a button when using word to display rtf messages fails

OK, no responses.

Try some other questions.

When word is used to display RTF messages, is the toolbar customizable?

Try this:
1. Send an RTF message using Outlook 2003.
2. Have a look in sent items, and display the message. Check that the
title bar shows that the messaeg is Rich Text.
3. Try manually customizing the toolbar. View | Toolbar. Note that
"Customize..." is disabled.

Does this mean also that the toolbar can't be progarmmatically
customized?

(Weird thing is that you can modify the message body - which normally
is readonly!)

Is this the same for anyone else, or is it just me setup?

(Please reply to maillist.)

james wrote:
Hi All,

I'm attempting to add a button (or any other control!) to the inspector
when displaying messages.

The sample below can be executed, and it will add a toolbar and button
in 3 out of 4 cases.

Works for message composition, both with word-as-editor enabled and
disabled.
Works for message display, not using word for RTF.
Fails when using word to display RTF messages. (Outlook | Tools |
Options | MailFormat | Use Microsoft Office 2003 to read Rich Text
e-mail messages)

A discussion in another forum alluded to Word being used in a mode
whereby its command bars are read only. Is there any basis to this?
I also noticed that Outlook Spy (2.10.0.352) doesn't load its command
bar when word is used to display an RTF message.

I have also tried navigating to the wordDoc CommandBars, and tried (a)
adding a new CommandBar, and (b) adding a new button to an existing
CommandBar, but eventually get the same result in both cases on
attempting to add the new control.

Using Outlook 2003 SP1.

Does anyone have any ideas? Or is it time to give up, and look for some
other way to display message status info to the user?

' Sample code to work out why can't add button to Outlook Word RTF
viewer
' Doesn't work when Outlook set up to use Word to view RTF messages
' Throws error: "Method 'Add' of _CommandBars failed" ErrorID
0x80004005
' Works in other cases
' a) compose using word editor
' b) compose using rtf(?) editor
' c) display using rtf(?) viewer

Option Explicit

Dim WithEvents objInspectors As Outlook.Inspectors
Dim WithEvents objInspector As Outlook.Inspector
Dim objCommandBar As office.CommandBar
Dim objCommandBarCtrl As office.CommandBarButton

Private Sub Application_Quit()
Set objInspectors = Nothing
End Sub

Private Sub Application_Startup()
Set objInspectors = Application.Inspectors
End Sub

Private Sub objInspector_Close()
Set objCommandBarCtrl = Nothing
Set objCommandBar = Nothing
Set objInspector = Nothing
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
Set objInspector = Inspector
' fails on the following line
Set objCommandBar = objInspector.CommandBars.Add("Hello",
office.msoBarTop, True, True)
objCommandBar.Enabled = True
objCommandBar.Visible = True

Set objCommandBarCtrl =
objCommandBar.Controls.Add(office.msoControlButton )
objCommandBarCtrl.Style = msoButtonCaption
objCommandBarCtrl.Visible = True
objCommandBarCtrl.Enabled = True
objCommandBarCtrl.Caption = "World!"
End Sub


  #3  
Old August 11th 06, 03:20 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Adding a button when using word to display rtf messages fails

Customize is grayed out for any WordMail item (in the UI). Check it out with
a new HTML email.

When you're in WordMail you can access Inspector.CommandBars but what you
get is the Word CommandBars collection. You can add items to "Menu Bar" and
create your own toolbar (CommandBar). Adding to Standard or whatever isn't
going to work and forget about adding buttons to the mail envelope toolbars.

--
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


"james" wrote in message
oups.com...
OK, no responses.

Try some other questions.

When word is used to display RTF messages, is the toolbar customizable?

Try this:
1. Send an RTF message using Outlook 2003.
2. Have a look in sent items, and display the message. Check that the
title bar shows that the messaeg is Rich Text.
3. Try manually customizing the toolbar. View | Toolbar. Note that
"Customize..." is disabled.

Does this mean also that the toolbar can't be progarmmatically
customized?

(Weird thing is that you can modify the message body - which normally
is readonly!)

Is this the same for anyone else, or is it just me setup?

(Please reply to maillist.)


  #4  
Old August 11th 06, 04:32 PM posted to microsoft.public.outlook.program_addins
james
external usenet poster
 
Posts: 8
Default Adding a button when using word to display rtf messages fails

Hi Ken,

You can add items to "Menu Bar" and
create your own toolbar (CommandBar).


I tried this and failed adding a CommandBar when _reading_ an RTF
message with word (see sample code from original post). It does works
if I'm composing a message.

My Outlook Spy doesn't load its command bar in this mode either.

Just trying to work out if something in my setup is causing this
probelm, or if its a general Outlook/WordMail limitation.

thanks


Ken Slovak - [MVP - Outlook] wrote:
Customize is grayed out for any WordMail item (in the UI). Check it out with
a new HTML email.

When you're in WordMail you can access Inspector.CommandBars but what you
get is the Word CommandBars collection. You can add items to "Menu Bar" and
create your own toolbar (CommandBar). Adding to Standard or whatever isn't
going to work and forget about adding buttons to the mail envelope toolbars.

--
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


"james" wrote in message
oups.com...
OK, no responses.

Try some other questions.

When word is used to display RTF messages, is the toolbar customizable?

Try this:
1. Send an RTF message using Outlook 2003.
2. Have a look in sent items, and display the message. Check that the
title bar shows that the messaeg is Rich Text.
3. Try manually customizing the toolbar. View | Toolbar. Note that
"Customize..." is disabled.

Does this mean also that the toolbar can't be progarmmatically
customized?

(Weird thing is that you can modify the message body - which normally
is readonly!)

Is this the same for anyone else, or is it just me setup?

(Please reply to maillist.)


  #5  
Old August 13th 06, 07:42 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Adding a button when using word to display rtf messages fails

It's a limitation.

--
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


"james" wrote in message
ups.com...
Hi Ken,

You can add items to "Menu Bar" and
create your own toolbar (CommandBar).


I tried this and failed adding a CommandBar when _reading_ an RTF
message with word (see sample code from original post). It does works
if I'm composing a message.

My Outlook Spy doesn't load its command bar in this mode either.

Just trying to work out if something in my setup is causing this
probelm, or if its a general Outlook/WordMail limitation.

thanks


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2003 RTF Messages Michael Outlook - General Queries 0 April 14th 06 12:49 PM
Adding button to New Message Window Joshua Ellul Add-ins for Outlook 5 March 22nd 06 02:10 PM
Adding a button to the Appointment Form [email protected] Add-ins for Outlook 6 March 21st 06 03:09 PM
Send - Receive Button Still Fails to appear John Outlook - Installation 0 January 18th 06 09:42 AM
Send - Receive Button fails to appear in Outlook 2003 John Outlook - Installation 2 January 15th 06 03:45 AM


All times are GMT +1. The time now is 09:28 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.