Attempting to Set MessageClass - Method Faild?

  • Thread starter Thread starter Ryan Hubbard
  • Start date Start date
R

Ryan Hubbard

I'm attempting to set the MessageClass of a MailItem but I get the
following error.

"Method 'MessageClass' of object 'MailItem' faild"

I also am trying to set the MailItem to a MailItem Object and I get a
TypeMismatch, but I am testing to make sure it is a MailItem first.
Can someone help me out?

Set myOlApp = CreateObject("Outlook.Application")
Set objInboxItems =
myOlApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items
Dim objMail As MailItem

If objInboxItems.Count > 1 Then
For I = 1 To objInboxItems.Count Step 1

If TypeName(objInboxItems.Item(I)) = "MailItem" Then
' This next line gives me the Method failed
objInboxItems.Item(I).MessageClass = "IPM.Test"
' This next line gives me a type mismatch
Set objMail = objInboxItems.Item(I).
End If
Next
End If
 
IPM.Test is not a valid message class for Outlook objects. Perhaps you meant
IPM.Note.Test?

But maybe it would also help if you explained what your actual goal here is.
 
Back
Top