Word as Email Editor/Inspectors/Commandbar

D

David McNealey

I've created an plug-in for Outlook. It creates commandbars
on Mail Inspector items.

Here is my problem, whenever Word is used as my
editor/reader, I have the followin problems:

Words as my email editor:
I add a FlagRequest to the mailitem. However, the
FlagRequest does not show in the inspector. When I look
back on my main Outlook Explorer, the flag indicator is
displayed next to the item in the list. If I click on the
FlagRequest button on the inspector, I can see the values I
set for the FlagRequest. On FlagRequest dialog, if I press
the OK or Cancel button, the FlagRequest will now show on
the Inspector.

Word as to read Rich-Text emails:
I cannot create any Commandbars to the inspector. I just
get a very unimformative error message. I have read on
other sites that adding commandbars under this condition is
not possible. Is this true? Is this a bug in Outlook?
 
K

Ken Slovak - [MVP - Outlook]

You don't mention your version of Outlook, but forget about getting an
Inspector in Outlook 2000 when a WordMail item is opened.

It works in Outlook 2002 or 2003 but is still funky. In Outlook 2003 I
can get an Inspector and add a CommandBar to it but when an item is
sent in code the Inspector remains open unless you close the
Word.Document.ActiveWindow and discard it, and then when you exit
Outlook you get a prompt about saving Normal.Dot, which has been
modified by your adding and then deleting your CommandBar object.
 
D

David McNealey

Thank you for your response. I am using Outlook 2003. I am
able to get the reference to the Inspector. However, I have
been unable to add the commandbar. Do you use a different
than the add method from the CommandBars object on the
inspector. Do you use the WordEditor object on the inspector?

Do you have a code example of how you added the commandbar?

Have you seen this issue I am having with the FlagRequest?
 
K

Ken Slovak - [MVP - Outlook]

I just use the Inspector.CommandBars collection and add my button to
the "Standard" toolbar. Then I delete it when the Inspector closes
even though I instantiate it as temporary. I do have something of a
glitch when the Click event fires for the button, the instantiated
button object is Nothing at that point. I have to save any states I
want for it as module level variables and just access the Button
object passed in the Click event handler.

I access the WordEditor object as a Word.Document when I want to make
sure the Inspector will actually close. I get the Document's File menu
from the "Menu Bar" CommandBar and then execute the Exit menu item.
That way the orphaned Word pane isn't left sitting there after the
item is sent or whatever. Also, if the user has prompt for saving
Normal.dot enabled they will be prompted each time Outlook is closed.
I haven't found a way around that. Using 0 as an argument for the
Document or ActiveWindow in the Close method still prompts for saving
Normal.dot and the other things I've played with also don't prevent
that.

I haven't played with flag requests in the Word editor.
 
G

Guest

I forgot to add this in, I only have this problem when the
email of type "Rich Text". Also, this problem only rears
itself when I am reading the email. I can create the
commandbars when I am on a composition (new, reply,
forward) email.

Thank you for your response. I am using Outlook 2003. I am
able to get the reference to the Inspector. However, I have
been unable to add the commandbar. Do you use a different
than the add method from the CommandBars object on the
inspector. Do you use the WordEditor object on the inspector?

Do you have a code example of how you added the commandbar?

Have you seen this issue I am having with the FlagRequest?
 
K

Ken Slovak - [MVP - Outlook]

I haven't seen your FlagRequest problem, not sure what it is.

Here's some code I used to create a new toolbar button in the Standard
toolbar in a WordMail item in Outlook 2003. The code runs in an
Inspector wrapper class that is instantiated when NewInspector fires:

Private Sub CreateButtons(objInspector As Outlook.Inspector, _
blnNew As Boolean)

Dim cbStd As Office.CommandBar
Dim strToolbar As String
Dim strToolTip As String
Dim strMessage As String
Dim strEntryID As String
Dim strVCID As String
Dim strKBID As String
Dim strName As String
Dim blnEnabled As Boolean
Dim strKey As String

On Error Resume Next

'code to load a button image into the clipboard
'from a resource file, the procedure is not shown here
basOutlook.GetClipboard
If blnNew Then
Clipboard.SetData LoadResPicture(101, 0)
Else
Clipboard.SetData LoadResPicture(102, 0)
End If

strKey = CStr(m_lngID)

'Adding a button to the Standard toolbar for any Inspector
strToolbar = "Standard"
Set cbStd = objInspector.CommandBars(strToolbar)

'Do button
m_strTag = "MyButton" & strKey
strToolTip = "my button's tool tip text"
strMessage = "My Button"

Set cbbModuleLevelButtonObject = cbStd.FindControl(Tag:=m_strTag)

If Not (cbbModuleLevelButtonObject Is Nothing) Then
cbbModuleLevelButtonObject.Delete
Set cbbModuleLevelButtonObject = Nothing
End If

If cbbModuleLevelButtonObject Is Nothing Then
Err.Clear
Set cbbModuleLevelButtonObject =
cbStd.Controls.Add(Type:=msoControlButton, _
Parameter:=m_strTag, Temporary:=True)

With cbbModuleLevelButtonObject
.DescriptionText = strToolTip
.BeginGroup = True
.Caption = strMessage
.PasteFace 'add icon
.Tag = m_strTag
.ToolTipText = strToolTip
.Style = msoButtonIconAndCaption
'the following syntax is critical
.OnAction = "!<" & gstrProgID & ">"
.Visible = True
.Enabled = True

If m_ButtonState Then
.State = msoButtonDown
Else
.State = msoButtonUp
End If
End With
End If

Clipboard.Clear
basOutlook.RestoreClipboard

Set cbStd = Nothing
End Sub
 

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