Hi
Here is a KB for your reference.
Considerations When You Use Microsoft Word as the E-Mail Editor
When you are designing an Outlook CommandBar solution for mail items, it
is
important that you understand that different CommandBars are used when
Microsoft Word is set as the e-mail editor. Some key points that you must
consider when you use Word as the e-mail editor are:
- CommandBars are part of Word, not Outlook.
- Different CommandBars are available based on the message editor and
format.
- Custom buttons may disappear when you change message editor or format.
- The special Envelope CommandBar is not designed to be customized.
- There is no Inspector object for the HTML and Plain Text formats with
Office 2000 if Word is set as the e-mail editor.
201095 OL: How to Use CommandBars in Outlook Solutions
http://support.microsoft.com/?id=201095
1 We can change the subject from Word/Outlook Process
[Outlook: the Application.ActiveInspector.CurrentItem is the MailItem]
Dim ip As Inspector
Set ip = Application.ActiveInspector
Dim mi As MailItem
Set mi = ip.CurrentItem
mi.Subject="dfdf"
[Word]
Sub Test()
Dim ol As Outlook.MailItem
Set ol = ThisDocument.CustomDocumentProperties.Parent.MailEnvelope.Item
ol.Subject = "dfdffasdfasdf"
End Sub
2. - CommandBars are part of Word, not Outlook. ReadAbove KB.
We can add a commandBar from Outlook/Word.
Because we can get the Word interface, so we can add commandbar via Word's
OM or Outlook'OM.
Now the problem is that if we do that in Outlook, the Button_click's code
is in the Outlook's process, but the button is owned by Word, when we
click
the button, the button will try to call the code in another
process(Outlook)
e.g.
Set cbb = ip.CommandBars("Standard").Controls.Add(msoControlButton, , , ,
True)
cbb.FaceId = 14
cbb.Caption = "afasdf"
3. As in 1. in Outlook, we can use CurrentItem to get the MailItem object,
so we can get the MailItem.Subject, MailItem.BCC......
4. We can access to the Word's OM from outlook, once we get the word's
reference, WordEditor. But now in outlook we add button to Word's
CommandBars, so the CommandBars will be invoked in word's, but we add
event
(Button_click) in Outlook, so the Click code is in the Outlook's process.
In Summary, we can modified the WordMail's content, subject ... from
Outlook Addin, the problem is cross process fire the Button_Click. If you
just wants to change the Subject, we can just do that in the Outlook's
Addin.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.