View Single Post
  #1  
Old May 22nd 09, 11:15 PM posted to microsoft.public.outlook.program_addins
dmjames
external usenet poster
 
Posts: 3
Default Chaning MessageClass with Preview Pane

I'm trying to change MessageClass when an item is opened so as to open a
custom form. My code works fine when the Preview Pane is closed; it doesn't
work when the pane is open. I've tried changing the form, clearing forms
cache, etc.; I'm sure it's not a form problem. I've tested and tried it many
times -- the behavior is that it works when Preview Pane is closed, and opens
the default IPM.Note when the Preview Pane is open. (If anyone is curious,
my ultimate goal is to provide a preview tab where all text in the message is
changed to an easy-to-read font, but not change the message permanently.)

Here's my code:

'CONNECTION CODE

Option Explicit

Dim WithEvents objInsps As Outlook.Inspectors

Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal
ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As
Object, custom() As Variant)
Set objInsps = Application.Inspectors
AddInInst.object = Me
End Sub

Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
Set objInsps = Nothing
End Sub


Private Sub objInsps_NewInspector(ByVal currInsp As Inspector)
Dim ci As New clsInspectors
If currInsp.CurrentItem.Class = olMail Then
If currInsp.CurrentItem.MessageClass = "IPM.Note" Or
currInsp.CurrentItem.MessageClass = "IPM.Note.Preview" Then
If currInsp.CurrentItem.EntryID vbNullString Then 'Sent
Set ci = InspColl.Add(currInsp,
currInsp.CurrentItem.entryid) 'collection of clsInspectors
ci.IID = currInsp.CurrentItem.EntryID
ci.FirstActivation = True
End If
End If
End If
End Sub

'CLSINSPECTORS

Option Explicit

Public WithEvents currInsp As Inspector
Public IID As String
Public FirstActivation As Boolean

Private Sub currInsp_Activate()
If FirstActivation Then
currInsp.CurrentItem.MessageClass = "IPM.Note.Preview"
currInsp.CurrentItem.Save
'The custom form contains a preview control on a tab called Preview,
which I populate here
'If the preview pane of the explorer from which I opened the item is
visible, currInsp.ModifiedFormPages("Preview") returns Nothing
FirstActivation = False
End If
End Sub

Private Sub currInsp_Close()
currInsp.CurrentItem.MessageClass = "IPM.Note"
currInsp.CurrentItem.Save
InspColl.Remove IID
End Sub

Thanks,

Dave James
Ads