how to dinamically change the IPM.Note form? in outlook client

O

Orlando

I have this macro below, the macro checks for a particular
sender, and then executes the instructions inside to
present the message using a customized IPM.Note form by
the name IPM.Note.XYZ
how to complete?

Thanks,
Private Sub Application_NewMail()
Dim myOlApp As Outlook.Application
Dim myNameSpace As NameSpace
Dim myInbox As MAPIFolder
Dim myMessages As Items
Dim myItem As Outlook.MailItem
Dim myPos As Integer
Dim objMailItem As Outlook.MailItem
Dim sEmailAddress As String
Dim sSubject As String
Dim sBody As String
'Gget last email item in inbox
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myMessages = myInbox.Items
Set myItem = myMessages.GetLast
Set myPnameSpace = myNameSpace
'Set myPFolder = myPnameSpace.GetDefaultFolder
(olPersonalRegistry)
'generate new email
myPos = InStr(myItem.SenderName, "MAPS")
If myPos > 0 Then
'***************************
' how to complete sucessfully?

Set myForm = myItem.FormDescription
myForm.MessageClass = "IPM.Note.ASL"
Set objMailItem = myItem
objMailItem.Save
End If
Set objMailItem = Nothing
Set myOlApp = Nothing
Set myNameSpace = Nothing
Set myInbox = Nothing
Set myMessages = Nothing
End Sub
 

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