A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Inspector.WordEditor always returns null



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 15th 09, 01:50 AM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.outlook.program_addins
Peter O'Dowd \(MVP\)
external usenet poster
 
Posts: 15
Default Inspector.WordEditor always returns null

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.WordEdi tor;

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



Ads
  #2  
Old April 15th 09, 03:05 PM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Inspector.WordEditor always returns null

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().

--
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


"Peter O'Dowd (MVP)" wrote in message
...
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.WordEdi tor;

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




  #3  
Old April 16th 09, 02:37 AM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.outlook.program_addins
Peter O'Dowd \(MVP\)
external usenet poster
 
Posts: 15
Default Inspector.WordEditor always returns null

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
"Ken Slovak - [MVP - Outlook]" wrote in message
...
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().

--
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


"Peter O'Dowd (MVP)" wrote in message
...
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.WordEdi tor;

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






  #4  
Old May 1st 09, 06:21 PM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.outlook.program_addins
Paul T (NJ, USA)
external usenet poster
 
Posts: 1
Default Inspector.WordEditor always returns null

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

--


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
WordEditor property for Inspector null in Outlook Philip Enny Add-ins for Outlook 14 September 24th 08 05:14 PM
Inspector wrapper and Inspector close not fireing [email protected] Add-ins for Outlook 1 June 20th 08 02:53 PM
Winform over Wordeditor Steffen Grellmann Add-ins for Outlook 2 July 10th 07 09:13 PM
Strange WordEditor Problem rdrtkd Outlook and VBA 0 June 15th 06 03:41 AM
Help! Inspector.Close is fired before Inspector.Activate handler finishes Sergey Anchipolevsky Add-ins for Outlook 8 February 9th 06 10:51 AM


All times are GMT +1. The time now is 08:13 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.