如何将XML中的特殊字符转换为VBA中的可读string?

我有下面的代码,这雅虎财经,并下载configuration文件的特定安全/股票:

Public Function getETFDetails(theSymbol As String) Dim xmlhttp As Object Dim strURL As String Dim x As String Dim sSearch As String, myDIV As String, theDeets As String 'theSymbol = "SPY" strURL = "http://finance.yahoo.com/q/pr?s=" & theSymbol & "+Profile" DeleteUrlCacheEntry (strURL) Set xmlhttp = CreateObject("msxml2.xmlhttp") With xmlhttp .Open "get", strURL, False .send x = .responsetext End With Set xmlhttp = Nothing sSearch = "Fund Summary" myDIV = Mid(x, InStr(1, x, sSearch) + Len(sSearch)) sSearch = "<td>" myDIV = Mid(myDIV, InStr(1, myDIV, sSearch) + Len(sSearch)) theDeets = Left(myDIV, InStr(1, myDIV, "</td>") - 1) getETFDetails = theDeets End Function 

这很好,我得到很好的结果。 但是,如果结果中包含特殊字符(例如S&P500 ETF,“SPY”),我会得到以下结果:

 The investment seeks to provide investment results that, before expenses, generally correspond to the price and yield performance of the S&amp;P 500® Index. 

和号和商标的处理是我的问题。 我如何从结果中得出结论? 我很好,完全删除它们,只是说它'SP 500',但我希望更强大的东西,然后通过一些字符列表(string)手动删除这些。 有什么想法吗? (我已经尝试过使用StrConv函数,但是这返回只是string的第一个字符,无论出于何种原因。)

VBA中没有内置的“HTML / XML解码”function,但可以将该string写入XML文档并读回文本。 例如:

 Set doc = CreateObject("Msxml2.DOMDocument.6.0") strXML = "S&amp;P 500" doc.LoadXML "<root>" & strXML & "</root>" strDecoded = doc.Text