' This function uses HTMLAgilityPack, available from NuGet.
' You must COM Register HTMLAgilityPack and reference it from your Excel macros.
' This is not a proper implementation, but should work in general.
Public Function StripHTML(html As Object, Optional NL As Boolean = False, Optional LI As Boolean = False) As String
Dim HDoc As HtmlAgilityPack.HtmlDocument
Dim ret As String
Dim htmlStr As String
ret = ""
On Error GoTo NoAgilityPack
' Create the HTML document object
Set HDoc = New HtmlAgilityPack.HtmlDocument
' Do not do anything if there is an error.
On Error Resume Next
' Load the HTML into the document (surround with HTML)
If InStr(1, ""
End If
html = "" & CStr(html) & ""
End If
' Optionally put newlines where line breaks are.
If NL Then
htmlStr = Replace(CStr(html), "
0 Then
If Mid(StringToDecode, CurChr + 2, 1) >= 0 And Mid(StringToDecode, CurChr + 2, 1) <= 9 Then
TempAns = TempAns & Chr(Val( _
Mid(StringToDecode, CurChr + 2, InStr(CurChr, StringToDecode, ";") - CurChr - 2)))
ElseIf Mid(StringToDecode, CurChr + 2, InStr(CurChr, StringToDecode, ";") - CurChr - 2) = "nbsp" Then
TempAns = TempAns & " "
End If
CurChr = InStr(CurChr, StringToDecode, ";")
End If
Case Else
TempAns = TempAns & Mid(StringToDecode, CurChr, 1)
End Select
CurChr = CurChr + 1
Loop
HttpDecode = TempAns
End Function