IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBA Outlook Discussion :

Macro pour répondre toujours en HTML ne fonctionne plus [OL-2019]


Sujet :

VBA Outlook

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Enseignant
    Inscrit en
    Août 2014
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Suisse

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Août 2014
    Messages : 10
    Points : 7
    Points
    7
    Par défaut Macro pour répondre toujours en HTML ne fonctionne plus
    Bonjour,

    J’utilise une macro pour répondre automatiquement en HTML à un message en texte brut.

    On peut trouver les explications ici et ici.


    Depuis quelques jours (probablement suite à une mise à jour Windows) cela ne fonctionne plus. Le message est transformé comme s’il y avait une modification du codage…

    Par exemple un message contenant en texte brut:

    "Bonjour et Merci"

    deviendra:

    "ℼ佄呃偙⁅呈䱍倠䉕䥌⁃ⴢ⼯㍗⽃䐯䑔䠠䵔⁌⸳⼲䔯≎ാ㰊呈䱍ാ㰊䕈䑁ാ㰊䕍䅔䠠呔ⵐ充䥕㵖䌢湯整瑮吭灹≥䌠乏䕔呎∽整瑸栯浴㭬挠慨獲瑥甽晴㠭㸢਍䴼呅⁁䅎䕍∽敇敮慲潴≲䌠乏䕔呎∽卍䔠捸慨杮⁥敓癲牥瘠牥楳湯ㄠ⸶⸰㔱〶⸱〲㜰∲ാ㰊䥔䱔㹅⼼䥔䱔㹅਍⼼䕈䑁ാ㰊佂奄ാ㰊ⴡ潃癮牥整⁤牦浯琠硥⽴汰楡潦浲瑡ⴠ㸭਍਍值㰾但呎匠婉㵅㸲潂橮畯⁲瑥䴠牥楣䈼㹒਍䈼㹒਍⼼但呎ാ㰊倯ാഊ㰊䈯䑏㹙਍⼼呈䱍>"


    Puis la macro ouvre la réponse au message, avec ma signature, en caractères ordinaires mais en texte brut et pas en html…!


    Sauriez-vous quelle modification ajouter pour régler ce problème?

    Merci beaucoup.


    Windows10 et Microsoft® Outlook® pour Microsoft 365 MSO (Version 2208 Build 16.0.15601.20072) 64 bits



    Ci-dessous le code de la macro:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    Sub ForceReplyInHTML()
     
    '=================================================================
    'Description: Outlook macro to reply to a message in HTML
    '             regardless of the current message format.
    '             The reply will use your HTML signature as well.
    '
    'author : Robert Sparnaaij
    'version: 1.0
    'website: https://www.howto-outlook.com/howto/replyinhtml.htm
    '=================================================================
     
        Dim objOL As Outlook.Application
        Dim objSelection As Outlook.Selection
        Dim objItem As Object
        Set objOL = Outlook.Application
     
        'Get the selected item
        Select Case TypeName(objOL.ActiveWindow)
            Case "Explorer"
                Set objSelection = objOL.ActiveExplorer.Selection
                If objSelection.Count > 0 Then
                    Set objItem = objSelection.Item(1)
                Else
                    Result = MsgBox("No item selected. " & _
                                "Please make a selection first.", _
                                vbCritical, "Reply in HTML")
                    Exit Sub
                End If
     
            Case "Inspector"
                Set objItem = objOL.ActiveInspector.CurrentItem
     
            Case Else
                Result = MsgBox("Unsupported Window type." & _
                            vbNewLine & "Please make a selection" & _
                            " or open an item first.", _
                            vbCritical, "Reply in HTML")
                Exit Sub
        End Select
     
        Dim olMsg As Outlook.MailItem
        Dim olMsgReply As Outlook.MailItem
        Dim IsPlainText As Boolean
     
        'Change the message format and reply
        If objItem.Class = olMail Then
            Set olMsg = objItem
            If olMsg.BodyFormat = olFormatPlain Then
                IsPlainText = True
            End If
            olMsg.BodyFormat = olFormatHTML
            Set olMsgReply = olMsg.Reply
            If IsPlainText = True Then
                olMsg.BodyFormat = olFormatPlain
            End If
            olMsg.Close (olSave)
            olMsgReply.Display
     
        'Selected item isn't a mail item
        Else
            Result = MsgBox("No message item selected. " & _
                        "Please make a selection first.", _
                        vbCritical, "Reply in HTML")
            Exit Sub
        End If
     
        'Cleanup
        Set objOL = Nothing
        Set objItem = Nothing
        Set objSelection = Nothing
        Set olMsg = Nothing
        Set olMsgReply = Nothing
     
    End Sub

  2. #2
    Futur Membre du Club
    Homme Profil pro
    Enseignant
    Inscrit en
    Août 2014
    Messages
    10
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 45
    Localisation : Suisse

    Informations professionnelles :
    Activité : Enseignant
    Secteur : Enseignement

    Informations forums :
    Inscription : Août 2014
    Messages : 10
    Points : 7
    Points
    7
    Par défaut Corrections de la Macro
    Bonjour,

    Cela fonctionne de nouveau!
    J’ai utilisé la macro indiqué dans ce commentaire et je l’ai modifié comme ci-dessous, et ça marche!

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    Sub AlwaysReplyInHTML_Kutools()
    Dim xSelection As Outlook.Selection
    Dim xItem As Object
    Dim xMail As Outlook.MailItem
    Dim xMailReply As Outlook.MailItem
     
    'On Error Resume Next
    Select Case TypeName(Application.ActiveWindow)
      Case "Explorer"
        Set xSelection = Application.ActiveExplorer.Selection
        If xSelection.Count > 0 Then
          Set xItem = xSelection.Item(1)
        Else
          MsgBox "Please select an item first!", vbCritical, "Kutools for Outlook"
          Exit Sub
        End If
      Case "Inspector"
        Set xItem = Application.ActiveInspector.CurrentItem
      Case Else
        MsgBox "Unsupported Window type." & vbNewLine & "Please select or open an item first.", vbCritical, "Kutools for Outlook"
        Exit Sub
    End Select
     
    If xItem.Class = olMail Then
      Set xMail = xItem
      'Changer le format ici, afin que la réponse inclut notre signature en html!
            xMail.BodyFormat = olFormatHTML
     
      Set xMailReply = xMail.Reply
      xMailReply.Display
      'xMailReply.BodyFormat = olFormatHTML
    Else
      MsgBox "No message item selected. Please select a message first.", vbCritical, "Kutools for Outlook"
      Exit Sub
    End If
     
    Set xMailReply = Nothing
    Set xMail = Nothing
    Set xItem = Nothing
    Set xSelection = Nothing
    End Sub

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [XL-2010] Macro pour générer une page html avec l'adresse de toutes mes cellules
    Par josep-t dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 11/04/2017, 14h31
  2. [XL-2013] Une macro pour cacher une colonne qui ne fonctionne plus
    Par DavidCsame dans le forum Macros et VBA Excel
    Réponses: 15
    Dernier message: 02/03/2015, 14h17
  3. [LibreOffice][Texte] Une macro pour styliser les paragraphes HTML
    Par Nerva dans le forum OpenOffice & LibreOffice
    Réponses: 4
    Dernier message: 05/11/2013, 19h15
  4. [Toutes versions] Macro pour mettre selection en html sur serveur
    Par djoumusic dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 11/07/2009, 08h31
  5. [HTML] Macro pour modifier plusieur fichier html
    Par naouah dans le forum Balisage (X)HTML et validation W3C
    Réponses: 1
    Dernier message: 16/01/2009, 09h40

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo