Untitled

 avatar
unknown
plain_text
2 years ago
1.4 kB
9
Indexable
Sub AlwaysReplyInHTML()
Dim oSelection As Outlook.Selection
Dim oItem As Object
'Obtenir l'élément sélectionné
Select Case TypeName(Application.ActiveWindow)
Case "Explorer"
Set oSelection = Application.ActiveExplorer.Selection
If oSelection.Count > 0 Then
Set oItem = oSelection.Item(1)
Else
MsgBox "Veuillez d'abord sélectionner un mail", vbCritical, "Répondre en HTML"
Exit Sub
End If
Case "Inspector"
Set oItem = Application.ActiveInspector.CurrentItem
Case Else
MsgBox "Type de fenêtre non pris en charge." & vbNewLine & "Veuillez d'abord sélectionner ou ouvrir un élément.", _
vbCritical, "Répondre en HTML"
Exit Sub
End Select
    Dim oMsg As Outlook.MailItem
Dim oMsgReply As Outlook.MailItem
Dim bPlainText As Boolean
'Modifier le format du message et répondre
If oItem.Class = olMail Then
Set oMsg = oItem
If oMsg.BodyFormat = olFormatPlain Then
bPlainText = True
End If
oMsg.BodyFormat = olFormatHTML
Set oMsgReply = oMsg.Reply
If bIsPlainText = True Then
oMsg.BodyFormat = olFormatPlain
End If
oMsg.Close (olSave)
oMsgReply.Display
'L'élément sélectionné n'est pas un élément de courrier
Else
MsgBox "Aucun élément de message sélectionné. Veuillez d'abord sélectionner un message.", _
vbCritical, "Répondre en HTML"
Exit Sub
End If
'Cleanup
Set oMsgReply = Nothing
Set oMsg = Nothing
Set oItem = Nothing
Set oSelection = Nothing
End Sub
Editor is loading...