View Single Post
  #4  
Old May 1st 09, 05: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

--


Ads