我想編寫一個導入功能,用於將數據從網站導入到ms訪問數據庫。原始數據存儲在mysql數據庫中,可通過遠程文本文件(csv)獲取。所以我只想訪問這個遠程文件並以vba讀取它。我使用的代碼如下,但似乎缺少引用。不知道哪些參考ActiveXperts.Http需要。任何人都可以幫忙嗎?從MS Access中的網站導入數據
THX 史蒂夫
Dim objHttp
Dim strUrl
Dim strData
' Create a HTTP instance
Set objHttp = CreateObject("ActiveXperts.Http")
' Write some information to console
MsgBox "ActiveSocket " & objHttp.Version & " demo."
MsgBox "Expiration date: " & objHttp.ExpirationDate & vbCrLf
Do
strUrl = InputBox("Enter a URL", "Input", "www.activexperts.com/products")
Loop Until strUrl <> ""
objHttp.LogFile = "C:\HttpLog.txt"
objHttp.Connect (strUrl)
If (objHttp.LastError <> 0) Then
MsgBox "Error " & objHttp.LastError & ": " & objHttp.GetErrorDescription(objHttp.LastError)
Else
strData = objHttp.ReadData
If (objHttp.LastError <> 0) Then
MsgBox "Error " & objHttp.LastError & ": " & objHttp.GetErrorDescription(objHttp.LastError)
Else
MsgBox strData
End If
objHttp.Disconnect
MsgBox "Disconnect."
End If
MsgBox "Ready."
你使用ActiveXperts.Http設置,或者您會考慮使用不同的對象? – HK1