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
|