Well, similar code using objDoc.Characters(1).InsertBefore strFile does work
in a new mail item, so it's a matter of WordMail not allowing writing to the
item unless it's set for editing. About the only way I see to do that is to
find the control that allows editing an email item and execute it.
Even with Outlook 2007 you can do that using the old style CommandBar
interface.
Dim oButton As Office.CommandBarButton
Set oButton = oInspector.CommandBars("Menu Bar").FindControl(Id:=5604,
Recursive:=True)
oButton.Execute
After that the email is put into edit mode and the Word type code
objDoc.Characters(1).InsertBefore strFile
will work. I'd see if saving the email item as well as the Document item or
instead of that is necessary though.
An alternative would be to use the Outlook object model and do something
like this:
Dim strBody As String
strBody = objMsg.Body
strBody = strFile & strBody
objMsg.Body = strBody
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Chris Weirup" wrote in message
...
Thanks for the note. I think this is the page you mentioned, which is very
useful:
http://outlookcode.com/article.aspx?id=59
However, Most of the points about the new WordEditor don't seem to either
apply to me or indicate that I should be able to do what I mentioned in my
first e-mail. I installed Outlook 2007 and Word 2007 at the same time, so
I
should have at least the majority of the methods and properties available.
Under the header "Word as the item editor", it says:
"...Inspector.WordEditor will return a Word.Document object for any type
of
Outlook item, except NoteItem, making it possible to use Word methods to
insert text and graphics, insert a QuickPart, format text, apply a theme,
and
perform other item body tasks that were difficult if not impossible to
perform in the past."
I can achieve similar behavior by opening an e-mail, then selecting "Edit
Message" under the "Actions-Other Actions" toolbar. Shouldn't I be able
to
do this via VBA? This seems like basic functionality, regardless if it's a
lightweight or heavyweight version of the Word editor.
Thanks!
- Chris