WordEditor property for Inspector null in Outlook

P

Philip Enny

I am writing an add in C# for Outlook 2007 that access the
ActiveInspector.WordEditor property in an event handler triggered by a
toolbar button. I have run across a situation where the WordEditor property
on the ActiveInspector is null. It so happens that the ActiveInspector is a
Contact, Mail, Task, or Calendar Inspector. Doesn't matter which Inspector.
I've checked the IsWordMail property which is true, but WordEditor is null.
This is only hapenning on one machine. Some additional information, I am not
accessing this object in the NewInspector event.

The code is:

_Document doc = (_Document)active_inspector.WordEditor;
Range range = doc.Application.Selection.Range;
object o = range; doc.Application.Selection.InlineShapes.AddPicture(path,
ref false_obj, ref true_obj, ref o);


doc in the above code snippet is null. Any feedback appreciated
 
K

Ken Slovak - [MVP - Outlook]

If it's only on one machine then it's specific to that machine obviously. I
haven't seen anything like that so far myself.

IsWordMail will always be true for Outlook 2007, so that's really a useless
flag for Outlook 2007.

Is Outlook the only 2007 version on that machine? Are the other Office
applications on that machine 2003 version? What about Word specifically on
that machine? Is it there, and if so what version?

No exceptions, only a null when instantiating doc? Do you get various other
properties from the ActiveInspector() if you instantiate an Inspector
object, or are they also null?

Usual questions like: what other addins? What happens if they're disabled?
Any synch software? What A-V, is it integrated with Outlook at all, any
changes if it's disabled?
 
P

Philip Enny

Answers to the questions:

Is Outlook the only 2007 version on that machine?
Are the other Office applications on that machine 2003 version?
What about Word specifically on that machine? Is it there, and if so what
version?
No exceptions, only a null when instantiating doc?
Do you get various other properties from the ActiveInspector() if you
instantiate an Inspector object, or are they also null?
What other addins?

What happens if they're disabled?
Any synch software?
What A-V, is it integrated with Outlook at all, any changes if it's disabled?
 
K

Ken Slovak - [MVP - Outlook]

Does the user notice anything odd about using their WordMail from a user
standpoint or do things look normal there?

I'd try disabling all other addins and seeing if that helps. If that doesn't
help then it's grasping at straws time. I'd run the Office Detect and
Repair, find and delete the WordMail template and run ScanPST on their PST
file if they're using one as their default delivery point. If all that fails
I'd try a new Outlook profile, not a copy of an existing profile.
 
F

freedbill

Hope this thread is still being monitored. I just added a new thread with
the identical situation. "problem with outlook 2007 wordeditor". I have
isolated the problem, I think, to Office 2007 Basic Edition (which contains
basic Outlook without BCM). By any chance, was your problem machine running
Office 2007 Basic Edition?
 
K

Ken Slovak - [MVP - Outlook]

BCM has nothing to do with WordMail. Is the version of Word the same as the
version of Outlook and are both from the same Office package? You might want
to try a repair of the Office installation.
 
F

freedbill

Both Word and Outlook are from the same package. This is a new computer and
it has not had any other office product on it.

I posted the following new thread Sunday evening (9/21) in Outlook forms
(wrong spot). You suggestions are greatly appreciated.


I have a VB program that controls Outlook programatically. The program uses
a class (olwrapper) which inturn uses Outlook to send an email. A snippit of
olwrapper follows:


Dim objoutlook As Outlook.Application
Dim objoutlookmsg As MailItem
Dim objinsp as outlook.inspector
Dim mydoc as word.document
Set objoutlook = New Outlook.Application
Set objoutlookmsg = objoutlook.CreateItem(olMailItem)
Set objinsp = objoutlookmsg.GetInspector
If objinsp.IsWordMail = True Then
If objinsp.EditorType = olEditorWord Then
objinsp.Activate 'this was added for outlook
2007
set mydoc = objinsp.wordeditor
mydoc.range.paste 'inserts info from clipboard
end if
end if


This code has worked fine with Office 2003. I had to insert the
inspector.activate event and it has worked fine with outlook 2007, until one
of my customers recently had a problem. The are using MS Office 2007 Basic
Edition, and the .wordeditor property is not getting set. It is always empty.

I did some further testing and was able to determine that the code works
fine with office 2007 standard and small business, but it does not work with
basic edition.

I inadverently discovered that the code will run with basic edition, if I
start outlook before running the code.

Any help or suggestions is greatly appreciated.
 
F

freedbill

Forgot to mention that I have tried doing a repair to no avail. Thanks again
for your advice.
 
K

Ken Slovak - [MVP - Outlook]

Where is your code running? Is this a standalone program or an addin or
what?
 
F

freedbill

As I stated in the thread. It is a standalone program that accesses Outlook
via a class module. The snippit of code is from the class module.
 
K

Ken Slovak - [MVP - Outlook]

Is there any sort of script stopper running on the problem computer that
might prevent creating a new Outlook session? Does it make a difference if
you use CreateObject() instead of using New?
 
F

freedbill

No sign of a script blocker. I tried testing CreateObject() vs New and
received the same result. I have also tried creating a new Outlook profile
(not copied) and have asked the Customer to uninstall and re-install MS Word.
I'll post results after they have completed the re-install.

The two odd circumstances are that this problem only occurs on one of
several computers running Office 2007, and that the problem goes away if I
start Outlook manually before running this program.

Thanks again for your adviced.
 
K

Ken Slovak - [MVP - Outlook]

I have seen problems like that before, but only with managed code starting
Outlook from a standalone application. Is this managed code? It looked like
VBA or VB6 code?

When I've seen the problem, it was caused by an Outlook addin. If Outlook
was started first the addin was able to initialize before the standalone
code started up. If the standalone code started Outlook it was blocked due
to the extremely long startup required by the addin code.

I'm wondering if the basic edition stuff is a red herring. Check in both the
COM addins dialog and in the registry at HKLM in addition to HKCU to see
what addins are installed on those machines. If there are any aside from the
Outlook VBA addin in HKLM then set their LoadBehavior values to 2 from 3 to
disable them from starting up when Outlook starts (do it of course when
Outlook isn't running).

See if that makes any difference. If it does make a difference then
re-enable the addins one at a time by restoring LoadBehavior and seeing
where the problem recurs. That would be the problem addin.

If that's the case you might need to inject some time delay between starting
Outlook and starting your working code.

It's a thought, anyway.
 
F

freedbill

Bingo! Timing has been the problem and the Adobe Acrobat 8 pdfMaker addin
was the culprit. Once it was disabled, the problem went away. It will
remain disabled for now, until I can programatically address the issue via
some sort of timing delay. To answer your question, this is VB6 code
starting Outlook.

Thank you for your asssitance!!
 
K

Ken Slovak - [MVP - Outlook]

The Adobe addins for Outlook are almost always a problem and have been for
years. I'm glad you figured it out.
 

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