Referencing to “Microsoft HTML Object library”
As we use the Microsoft HTML Object Library for the conversion of html code to plain textBelow is a code to convert html to plain text in VBA:
Public Function HtmlToText(ByVal sHTML As String) As String Dim iDoc As HTMLDocument Dim result As String Dim paragraphs() As String If IsNull(sHTML) Then HtmlToText = "" Exit Function End If result = "" paragraphs = Split(sHTML, "") For Each paragraph In paragraphs Set iDoc = New HTMLDocument iDoc.body.innerHTML = paragraph result = result & Chr(10) & Chr(10) & iDoc.body.innerText Next paragraph HtmlToText = result End FunctionHope this is helpful when you want to convert html to plain text. Leave your comments if you like the solution.