Outlook 2007 Inspector.WordEditor is always Nothing



We are writing a shared add-in using VS2008 SP1 VB Dot.Net 3.5 and the
target of the add-in is Outlook 2007 SP1 12.0.6514.5000 (part of Microsoft
Office Enterprise 2007).
The OS is Windows XP Professional SP3.

Initially all areas of the code functioned without issue.

The area that translates Lotus Notes clipboard information into a hyperlink
now no longer functions for the following reason:-
The Outlook object that provides access to the body of the email
Inspector.WordEditor now returns Nothing instead of an instance of a

Note that it occasionally intermittently works; then ceases.

We have set our Add-in up as a trusted Add-In and have followed the correct
object model references. IsTrusted = true

Note that many references and web links on the subject have been researched
and tested, but we still have an issue of the WordEditor value being set to
Nothing as shown in the code snippet below:-

#Region "Outlook Ribbon Events"

''' <summary>
''' paste Notes Link action
''' </summary>
''' <remarks></remarks>
Public Sub onActionCorrsOutlookPasteButtons(ByVal control As
If m_activeInspector Is Nothing Then
End If
If m_eventTimerOutlook.Enabled = True Then
End If

Dim anchor As String = String.Empty
Dim uri As String = String.Empty

If (TypeOf m_activeInspector.CurrentItem Is MSOutlook.MailItem) Then
Dim cliptext As String = Helpers.Library.GetClipboardText()
Dim notesURL As String = OutlookLibrary.GetNDLURL(cliptext)
Dim strings() = Split(notesURL, "|")

Dim mailItem As MSOutlook.MailItem =
CType(m_applicationOutlook.ActiveInspector.CurrentItem, MSOutlook.MailItem)
Dim inspector = mailItem.GetInspector()

Dim document As MSWord.Document = CType(inspector.WordEditor,
If document Is Nothing Then
Logger.Log(Me.GetType(), "onActionCorrsOutlookPasteButtons",
"WordEditor returned nothing for paste function", TraceEventType.Error)
OutlookInspector.InsertLink(document, strings(1), strings(0))
End If
End If
If m_eventTimerOutlook.Enabled = True Then
End If
End Sub

The code exits with document = Nothing instead of ececuting the InsertLink

We have up to date AV software, Symantec Endpoint protection.
Can you please advise on how we find a work around to use the WordEditor in
Outlook as this has created a critical blockage in our development cycle?

I was advised by our Microsoft Acount mangager to post to the VSTO Forum to
receive MSDN priority support; but I note that that forum is for VSTO
generated add-ins and ours is a shared-addin. Could the moderator please
advise whether this is the correct forum to recieve priority support for our

Thank you in advance...



Ken Slovak - [MVP - Outlook]

This is a good forum for your question.

In Outlook 2007 you only get a weak object reference a newly opened
Inspector until the first Activate() event fires on that Inspector. A weak
object reference will only have a small subset of its properties filled out
and valid. Among the properties not valid until that first Activate() are

Depending on when your ribbon callback is firing would determine if you can
get a valid document object as you want.

What I usually do is to instantiate the WordEditor object in the first
Activate() and make it available as a public property on my Inspector
wrapper class. I also call to invalidate the ribbon in that event and at
that point I can get the relevant wrapper class and pick up any properties I
need, including WordEditor.


Thanks for confirming this is the correct forum.

I had read yours and others posts related to the weak object reference and
had implemented the Activate solution in my Inspector wrapper without success
(see below):-

Private Sub m_inspector_Activate() Handles m_inspector.Activate
' TODO : WordEditor is Nothing
If (TypeOf m_inspector.CurrentItem Is MSOutlook.MailItem) Then
'Only mail
If m_inspector.IsWordMail Then
If m_inspector.EditorType =
Microsoft.Office.Interop.Outlook.OlEditorType.olEditorWord Then
If Not m_inspector.WordEditor Is Nothing Then
m_document = CType(m_inspector.WordEditor,
Debug.Print("WordEditor in wrapper is Nothing")
"m_inspector_Activate", "WordEditor document is Nothing",
End If
'Logger.Log(Me.GetType(), "m_inspector_Activate",
"Editor type is not Word", TraceEventType.Error)
End If
'Logger.Log(Me.GetType(), "m_inspector_Activate",
"Editor is not Word Editor", TraceEventType.Error)
End If
End If
End Sub

m_document is published as Property in the wrapper:-

Public ReadOnly Property Document() As MSWord.Document
Return m_document
End Get
End Property

The wrapper is instanciated by the NewInspector Event.

When the mail item activates I use the Locals and WordEditor is the only
property not set as expected.

Please Note the following. In different deployment situations the WordEditor
code will return a word document. Initially during development the code from
the ribbon callback worked fine; then stopped working. I introduced the addin
to our production environment and both the callback and activate event
returned a Word Document. I installed Office 2007 as well as Office XP.

On our new environment Office 2007 the add-in WordEditor is always Nothing.

Could you email me a small shared addin project (in VB.Net) that you have
working that returns the WordEditor object and I can see if it works on our

This will greatly assist in determining the source of our problem.

Thanks in advance...

Ken Slovak - [MVP - Outlook]

Sorry, I don't email projects to anyone. You can download a project template
from my Web site and try it out and add whatever code you want to check out
WordEditor. That page is at

If things were working and then stopped working, you really need to see what
changed from when things were working.

I don't understand something you said: "I installed Office 2007 as well as
Office XP". What exactly does that mean? You don't install multiple versions
of Office on a machine, so where are you installing those versions of


No problem with the project. I had already downloaded your VBAddinTemplate
project and used that to add WordEditor code. See the Activate code in the
last post.

I tried to establish what had changed (environmentally or with Outlook
patches/versions) when it stopped working but have drawn a blank.

It is possible to install two office versions side-by-side (but not
recommended). I used Microsoft supplied documentation to do this. I only did
this so that I could check whether the code could function correctly in
another environment. Which it did.

I repeated the test code (based on your project) and it failed in our Office
2007 enviroment.

All the work stations with are new Office 2007 environment fail with this
issue. What can we do to establish the cause of the problem. I have ensured
that all other active addins have been de-activated durin testing.

As the object model guard will block WordEditor object we have ensured that
the add-in is trusted and added code to check IsTrusted. We also checked that
the AntiVirus shows valid in the Trust Centre.

This issue is causing a critical blockage to our development.

Any suggestions about how to proceed will be appreciated...

Ken Slovak - [MVP - Outlook]

While you can install multiple versions of the other Office apps such as
Word or Excel, you cannot do that with Outlook. Each version of Outlook has
a matched version of MAPI and you can only have 1 MAPI version installed. So
either things break completely or don't work or partially work and really
mess you up.

I'd also be cautious with multiple versions due to problems with WordMail
and which version of Word is installed.

If you are developing your addin for Outlook 2007 then You should be
referencing the Outlook and Office 2007 PIA's. You should not have any other
version of Office installed on the development system.

I'd then make sure that where you test that the same version and SKU of Word
are installed as the Outlook version and SKU. Then see if you still have
problems. If not then you know not to install multiple versions of Office
and to try and test on that environment.




The multiple versions is not an issue as I only did that once as a check; and
the WordEditor worked.

I am currently developing and testing on a Office 2007 Enterprise only
environment with the Office 2007 PIA's with no other Office installed.

I will check the SKU and see the result...




We have been able to establish (yesterday) that our WordEditor issue is
caused by a software upgrade to our Document Management system.

If we remove the Document Management software upgrade our code functions

I used the OutlookSpy utility WordEditor button to confirm that an
environmental issue was causing the problem.

Thank you for your efforts and assistance to resolve our issue.

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