Jump to content

Toujours répondre en "HTML" ?


Original

Recommended Posts

Je viens d'avoir @Patricia, notre experte ès Outlook, hors forum.

Elle m'explique qu'il n'y a pas d'automatisme possible. On choisi dans l'envoi du message, dans options, si on désire du texte brut, de l'HTML ou du texte enrichi (vérifié chez moi sur un 2007).

Merci à elle!! :)

Link to comment
Share on other sites

J'ai une solution, j'ai testé sous Outlook 2013, ça fonctionne. C'est une macro qui gère ça.

  1. Ouvrir Outlook
  2. Alt+F11 pour ouvrir le panneau VBA
  3. Développer dans le panneau de gauche jusque voir ThisOutlookSession
  4. Double cliquez dessus pour ouvrir a droite une session de code
  5. Collez le code ci-dessous
Option Explicit 
 
Private WithEvents oExpl As Explorer 
Private WithEvents oItem As MailItem 
 
Private bDiscardEvents As Boolean
Private olFormat As OlBodyFormat 
 
 
Private Sub Application_Startup() 
     
   Set oExpl = Application.ActiveExplorer 
     
   bDiscardEvents = False
     <strong>
   'olFormat = olFormatPlain        '(*1) - reply using plain text  
   olFormat = olFormatHTML        '(*2) - reply using HTML </strong>
     
End Sub
 
Private Sub oExpl_SelectionChange() 
 
   On Error Resume Next
   Set oItem = oExpl.Selection.Item(1) 
     
End Sub
 
Private Sub oItem_Reply(ByVal Response As Object, Cancel As Boolean) 
 
   If bDiscardEvents Or oItem.BodyFormat = olFormat Then
       Exit Sub
   End If
     
   Cancel = True
 
   bDiscardEvents = True
     
   Dim oResponse As MailItem 
   Set oResponse = oItem.Reply 
   oResponse.BodyFormat = olFormat 
   oResponse.Display 
     
   bDiscardEvents = False
     
End Sub
 
Private Sub oItem_ReplyAll(ByVal Response As Object, Cancel As Boolean) 
 
   If bDiscardEvents Or oItem.BodyFormat = olFormat Then
       Exit Sub
   End If
 
   Cancel = True
   
   bDiscardEvents = True
     
   Dim oResponse As MailItem 
   Set oResponse = oItem.ReplyAll 
   oResponse.BodyFormat = olFormat 
   oResponse.Display 
     
   bDiscardEvents = False
     
End Sub
 
Private Sub oItem_Forward(ByVal Forward As Object, Cancel As Boolean) 
     
   If bDiscardEvents Or oItem.BodyFormat = olFormat Then
       Exit Sub
   End If
     
   Cancel = True
 
   bDiscardEvents = True
     
   Dim oResponse As MailItem 
   Set oResponse = oItem.Forward 
   oResponse.BodyFormat = olFormat 
   oResponse.Display 
     
   bDiscardEvents = False
     
End Sub

 

Attention tout de même à la sécurité de l’exécution des macro !

La partie en gras dans le code permet de changer si c'est tout le temps en HTML ou en RTF/plain text il suffit de commenter ou décommenter les lignes. Le code est pour du HTML only :)

 

Edited by MathTek
Link to comment
Share on other sites

×
×
  • Create New...