What is objExplorer_SelectionChange and HTMLBody portion of mail

M

masani paresh

Could any one please tell me what below code do?

Private Sub objExplorer_SelectionChange()
Dim objMail As Outlook.MailItem
If objExplorer.Selection.Count > 0 Then
For Each objMail In objExplorer.Selection
If objMail.Class = olMail Then
If objMail.BodyFormat = olFormatHTML Then
objMail.HTMLBody = ClickDial(objMail.HTMLBody,
Webdial_Url)
End If
End If
Next
End If
End Sub
 
K

Ken Slovak - [MVP - Outlook]

Pretty obvious, no?

When the selection changes in that Explorer if 1 or more items are selected
each mail item in the selection is instantiated and if it's an email item
and an HTML item then some ClickDial() method is called with the HTMLBody
and another argument.

Of course that code will fire lots of exceptions since it assigns a MailItem
object as the Selection item being iterated, and if it's not an email item
an exception will fire. Better written code would check to see if the Class
property was olMail before assigning the object to a MailItem object.
 

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