Inspector.WordEditor always returns null

  • Thread starter Peter O'Dowd \(MVP\)
  • Start date
Status
Not open for further replies.
P

Peter O'Dowd \(MVP\)

I'm writing an Outlook Add-In, using C# in VS 2005. ( not using VSTO) .

The Add-In uses the shim provided my Microsoft for developing add-ins.

Here's a snippet of the code...

Outlook.Inspector oi = MailItem.GetInspector;

Microsoft.Office.Interop.Word.Document doc =

(Microsoft.Office.Interop.Word.Document)oi.WordEditor;

I need to position the cursor at a certain location in a part of message

body I populate when the mail item is created, hence why I need access to

the WordEditor

Any help greatly appreciated...

Thanks

Peter O'Dowd

Exchange Server MVP

http://www.blade.net.nz
 
Hi Peter,

Outlook version you want to work with?

In Outlook 2007 I've found that until the first Inspector.Activate() event

fires that IsWordMail() and WordEditor are null. That's especially the case

if you try to get those during NewInspector().

"Peter O'Dowd (MVP)" <petero@nospam.com> wrote in message

news:u$FBDvVvJHA.4476@TK2MSFTNGP02.phx.gbl...
> I'm writing an Outlook Add-In, using C# in VS 2005. ( not using VSTO) .
> The Add-In uses the shim provided my Microsoft for developing add-ins.

> Here's a snippet of the code...
> Outlook.Inspector oi = MailItem.GetInspector;

> Microsoft.Office.Interop.Word.Document doc =
> (Microsoft.Office.Interop.Word.Document)oi.WordEditor;

> I need to position the cursor at a certain location in a part of message
> body I populate when the mail item is created, hence why I need access to
> the WordEditor

> Any help greatly appreciated...
> Thanks

> > Peter O'Dowd
> Exchange Server MVP
> http://www.blade.net.nz

>
 
Hi Ken,

Yes it is Outlook 2007. Thanks for the info, I'll investigate :)

Cheers

Peter O'Dowd

Exchange Server MVP

http://www.blade.net.nz
<kenslovak@mvps.org> wrote in message

news:uqlTDscvJHA.4476@TK2MSFTNGP02.phx.gbl...
> Hi Peter,

> Outlook version you want to work with?

> In Outlook 2007 I've found that until the first Inspector.Activate() event
> fires that IsWordMail() and WordEditor are null. That's especially the
> case if you try to get those during NewInspector().

> >

>

> "Peter O'Dowd (MVP)" <petero@nospam.com> wrote in message
> news:u$FBDvVvJHA.4476@TK2MSFTNGP02.phx.gbl...
> > I'm writing an Outlook Add-In, using C# in VS 2005. ( not using VSTO) .
> > The Add-In uses the shim provided my Microsoft for developing add-ins.
>

>> Here's a snippet of the code...
> > Outlook.Inspector oi = MailItem.GetInspector;
>

>> Microsoft.Office.Interop.Word.Document doc =
> > (Microsoft.Office.Interop.Word.Document)oi.WordEditor;
>

>> I need to position the cursor at a certain location in a part of message
> > body I populate when the mail item is created, hence why I need access to
> > the WordEditor
>

>> Any help greatly appreciated...
> > Thanks
>

>
>> > > Peter O'Dowd
> > Exchange Server MVP
> > http://www.blade.net.nz
>

>
>>

>
 
I am having the same problem after the upgrade to 2007 wiht outomation that I

had in place with NewInspector() event... My work-around was the following:

1) Use NewInspector event to set local class variable to the inspector

2) Define the Activate event for the new inspector variable.

Here is my simplified code with the asnwer:

---
Dim myOlApp As New Outlook.Application

Public WithEvents myOlInspectors As Outlook.Inspectors

Public WithEvents oActiveInsp As Outlook.Inspector

Public Sub Initialize_handler()

Set myOlApp = Application

Set myOlInspectors = myOlApp.Inspectors

End Sub

Private Sub oActiveInsp_Activate()

' your processing code goes here... wordEditor will be defined now.

' I suggest unsetting oActiveInsp once you're done with it, so that it

does not impact performance everytime you focus on this inspector.

set oActiveInsp = nothing

End Sub

Private Sub myOlInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)

Set oActiveInsp = Inspector

End Sub

----
"Peter O'Dowd (MVP)" wrote:


> Hi Ken,
> Yes it is Outlook 2007. Thanks for the info, I'll investigate :)
> Cheers

> --
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
T How to get Inspector or MailItem from wordEditor Outlook VBA and Custom Forms 6
M Outlook 2010 How could I globally redesign an outlook template form/region/inspector template used to display mail lists or an individual mails? Outlook VBA and Custom Forms 0
B Auto Preview Attachment in Inspector Reading Pane Outlook VBA and Custom Forms 1
D help with Item/Inspector close event Outlook VBA and Custom Forms 1
T New Inspector word editor crash Outlook 2003 Outlook VBA and Custom Forms 3
A running code after the new inspector is visible Outlook VBA and Custom Forms 1
N Modal form is not properly working on inspector Outlook VBA and Custom Forms 10
K add a designed group into a existing inspector ribbon Outlook VBA and Custom Forms 7
E Accessing a Form Region from an Inspector Outlook VBA and Custom Forms 3
E Accessing a Form Region from an Inspector Outlook VBA and Custom Forms 3
T How to get Inspector object from Window handle Outlook VBA and Custom Forms 2
K Get Inspector Ptr In Outlook 2007. Outlook VBA and Custom Forms 3
S PR_MESSAGEFLAGS & Compose/Read - Inspector Outlook VBA and Custom Forms 4
S Error 287 on Inspector.Close() Outlook VBA and Custom Forms 4
K Buttons are added multiple times in New Inspector window Outlook VBA and Custom Forms 4
V How to find mailitem in the inspector is a brand new one Outlook VBA and Custom Forms 2
A active inspector in memory Outlook VBA and Custom Forms 1
B How to get the path from an outlook.Inspector Outlook VBA and Custom Forms 4
M How to get active inspector window handle? Outlook VBA and Custom Forms 3
A disable a menu in active inspector Outlook VBA and Custom Forms 1
S inspector toolbar buttons get multiple events Outlook VBA and Custom Forms 3
S Quick access toolbar in inspector window Outlook VBA and Custom Forms 3
T Using Ribbon in Inspector window Outlook VBA and Custom Forms 2
Q Inspector Bug/Question Outlook VBA and Custom Forms 3
Z Inspector.CurrentItem causes Shared Calendar Issue Outlook VBA and Custom Forms 5
R Outlook 2016 wordeditor Outlook VBA and Custom Forms 3
A How can I load a HTML template into the WordEditor? Outlook VBA and Custom Forms 3
R Programmatic Access Security Pop up with Wordeditor Outlook VBA and Custom Forms 6
P Can't add custom field to custom Outlook form, it always adds to the Folder instead Outlook VBA and Custom Forms 2
U Disable "Always ask before opening" Dialog Using Outlook 3
DoctorJellybean Outlook 365 doesn't always mark emails as read Using Outlook 3
Commodore Folders always closed in move/copy items dialog box Using Outlook 3
B The Outlook 2016 Profile that isn't always there Using Outlook 2
K VBA BeforeItemMove event create rule to always move to its folder. Outlook VBA and Custom Forms 4
B When working on emails in a certain folder, when I hit reply or reply all, I would like it re always reply all and add an email address to send to Outlook VBA and Custom Forms 3
M Item edits doesn't always sync Using Outlook 11
Diane Poremsky How to Always Process Mail After Business Hours Using Outlook 0
Diane Poremsky Always Load an Outlook Addin Using Outlook 1
M Always Enabled Outlook VBA and Custom Forms 3
Z Always Send from Default Account, depend of receive account Outlook VBA and Custom Forms 7
R Coming from Thunderbird: "Always prefer display name over message header" Using Outlook 1
W Filter condition "contains"/"doesn't contain" doesn't always work Using Outlook 10
B Add-in "always enabled" but Outlook 13 won't open Using Outlook 7
C Reports always ask 'Would you like to save your changes?' BCM (Business Contact Manager) 1
T In Outlook 2013, must downloaded pictures in an email always be retained? Using Outlook 8
2 How to use outlook 2003 calendar in always offline mode Using Outlook 0
L Oulook always "disconnected" how do I keep it open all of the time? Using Outlook 1
S Please help! -- Linked Account field at Business Contacts tab is always empty BCM (Business Contact Manager) 1
J Rule does not always work Using Outlook 6
B Outlook 2003: Meeting Organizer will be set as always free or busy status Using Outlook 1

Similar threads

Back
Top