【发布时间】:2017-11-29 02:19:42
【问题描述】:
我一直在使用以下代码从网上读取文本文件:
'import the text file into a string
Function DownloadTextFile(URL As String) As String
On Error GoTo Err_GetFromWebpage
Dim objWeb As Object
Dim strXML As String
' Instantiate an instance of the web object
Set objWeb = CreateObject("Microsoft.XMLHTTP")
' Pass the URL to the web object, and send the request
objWeb.Open "GET", URL, False
objWeb.send
' Look at the HTML string returned
strXML = objWeb.responseText
DownloadTextFile = strXML
End_GetFromWebpage:
' Clean up after ourselves!
Set objWeb = Nothing
Exit Function
Err_GetFromWebpage:
' Just in case there's an error!
MsgBox Err.Description & " (" & Err.Number & ")"
Resume End_GetFromWebpage
End Function
第一次运行良好,但是当我对文本文件进行更改时,它并没有反映在返回的字符串中。就好像 Excel 正在缓存文件一样。我能做些什么来解决这个问题?谢谢!
【问题讨论】:
标签: excel vba http caching reload