What is objExplorer_SelectionChange and HTMLBody portion of mail

  • Thread starter Thread starter masani paresh
  • Start date Start date
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
 
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.
 
Back
Top