On Error Resume Next
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile("d:\123.txt")
md =DateValue(f.DateLastModified)
nd=date
if md<>nd then
url="http://www.baidu.com/img/baidu_logo.gif"
Set xmlHTTP=createobject("Microsoft.XMLHTTP")
xmlhttp.open "GET", URL, false
xmlhttp.send
if err.number <> 0 then
flagText = "google.com"
else
flagText = left(xmlhttp.responseText, 1703)
set regex = new RegExp
regEx.Global = True
regex.pattern = "^\s*"
flagText = regex.replace(flagText, "")
regex.pattern = "^<.*>"
flagText = regex.replace(flagText, "google.com")
flagText = left(flagText, 10)
end if
If flagText <> "google.com" Then
msgbox "存在"
else
msgbox "不存在"
end if
else
msgbox "今天修改过"
end if作者: ywjco 时间: 2009-9-15 13:32 试过你的代码,没有问题。只是要先建立“d:\123.txt”这个文件。
***************************************
On Error Resume Next
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile("d:\123.txt")
md=DateValue(f.DateLastModified)
nd=date
if md<>nd then
url="http://www.baidu.com/img/baidu_logo.gif"
Set xmlHTTP=createobject("Microsoft.XMLHTTP")
xmlhttp.open "GET", URL, false
xmlhttp.send
if err.number <> 0 then
flagText = "google.com"
else
flagText = left(xmlhttp.responseText, 1703)
set regex = new RegExp
regEx.Global = True
regex.pattern = "^\s*"
flagText = regex.replace(flagText, "")
regex.pattern = "^<.*>"
flagText = regex.replace(flagText, "google.com")
flagText = left(flagText, 10)
end if
If flagText <> "google.com" Then
msgbox "存在"
else
msgbox "不存在"
end if
else
msgbox "今天修改过"
end if
********************************************
最后,还应加上两行:
Set fso = Nothing
Set f =Nothing