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:
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 |