'先下载文件
Private Declare Function DeleteUrlCacheEntry Lib "wininet" _
Alias "DeleteUrlCacheEntryA" _
(ByVal lpszUrlName As String) As Long
'下载文件
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
DELCOOKIES URL
'下载前先删除IE缓存中可能己有的文件
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then
DownloadFile = True
DELCOOKIES URL
'下载完成后删除Cookies,以绝后患
End If
End Function
Public Sub DELCOOKIES(FileName As String)
'删除Cookies
DeleteUrlCacheEntry (FileName)
End Sub
'调用DownloadFile下载到文件,然后用open打开并读取文件中的数据
'然后用shell执行