我不明白爲什麼我會得到這種奇怪的行爲! 當創建並分配htmlfile對象時,該函數會返回一個空白對象(「nothing」),並且當我逐行運行代碼時,即使不按F8運行下一行,它也會自動運行。 它沒有任何錯誤! 關於可能發生什麼的任何想法?createobject(「HTMLFILE」)非常奇怪的行爲!
行這裏的怪現象開始:Set htmlObj = CreateObject("HTMLFILE")
Public Function XMLHTTP_Request(Method As String, URL As String, Optional PostData As String, Optional StrCookie As String) As HTMLDocument
Dim oXMLHTTP As Object, htmlObj as object
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP")
oXMLHTTP.Open Method, URL, False
oXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXMLHTTP.setRequestHeader "Cookies", StrCookie
On Error GoTo ErrorHandler
oXMLHTTP.send (PostData)
On Error GoTo 0
While oXMLHTTP.ReadyState <> 4: DoEvents: Wend
While oXMLHTTP.Status <> 200: DoEvents: Wend
Set htmlObj = CreateObject("HTMLFILE")
htmlObj.body.innerHTML = oXMLHTTP.responseText
Set XMLHTTP_Request = htmlObj
End Function
*超標記文本語言*? – Jeeped
@pnuts:好的,刪除它。 – jony
@Jeeped是的,HTMLDocument。 – jony