子测试()子测试() GetAFile _ " http://ffdba.com/downloads/How_Many_WeekDays.dat",_ " c:/How_Many_WeekDays.dat" 结束子 (您需要登录该站点,假设它不公开。) - Lyle (对于e-邮件参考 http://ffdba.com/ ) I would like to somehow get a file from a web address such as: http://www.myserver.com/data/names.txtand use in access.I know I can use the Set http = CreateObject("microsoft.xmlhttp")to read the file, but it will be pretty big like maybe over 1000 lines.So how would I save this output to a text file, so I can then read it into atable (it is a tab delimited file). I know how to do importing, but justneed help saving this big text to a text file.Thanks again 解决方案Pretty well everyone uses ADO for almost everything now!Public Sub GetAFile( _ByVal URL As String, _ByVal Destination As String, _Optional ByVal UserName As String, _Optional ByVal Password As String)Dim r As ADODB.RecordSet r = New ADODB.RecordURL = "URL=" & URLDestination = "file://" & DestinationWith rIf Len(UserName) > 0 Then.Open "", URL, , _adOpenIfExists Or adCreateCollection, _, UserName, PasswordElse.Open "", URL, , _adOpenIfExists Or adCreateCollectionEnd If.CopyRecord , Destination.CloseEnd WithEnd SubSub test()GetAFile _"http://ffdba.com/downloads/How_Many_WeekDays.dat", _"c:/How_Many_WeekDays.dat"End Sub(you need the login for the site assuming it''s not public.)--Lyle(for e-mail refer to http://ffdba.com/) Pretty well everyone uses ADO for almost everything now! Public Sub GetAFile( _ ByVal URL As String, _ ByVal Destination As String, _ Optional ByVal UserName As String, _ Optional ByVal Password As String) Dim r As ADODB.Record Set r = New ADODB.Record URL = "URL=" & URL Destination = "file://" & Destination With r If Len(UserName) > 0 Then .Open "", URL, , _ adOpenIfExists Or adCreateCollection, _ , UserName, Password Else .Open "", URL, , _ adOpenIfExists Or adCreateCollection End If .CopyRecord , Destination .Close End With End Sub Sub test() GetAFile _ "http://ffdba.com/downloads/How_Many_WeekDays.dat", _ "c:/How_Many_WeekDays.dat" End Sub (you need the login for the site assuming it''s not public.) -- Lyle (for e-mail refer to http://ffdba.com/) Pretty well everyone uses ADO for almost everything now! Public Sub GetAFile( _ ByVal URL As String, _ ByVal Destination As String, _ Optional ByVal UserName As String, _ Optional ByVal Password As String) Dim r As ADODB.Record Set r = New ADODB.Record URL = "URL=" & URL Destination = "file://" & Destination With r If Len(UserName) > 0 Then .Open "", URL, , _ adOpenIfExists Or adCreateCollection, _ , UserName, Password Else .Open "", URL, , _ adOpenIfExists Or adCreateCollection End If .CopyRecord , Destination .Close End With End Sub Sub test() GetAFile _ "http://ffdba.com/downloads/How_Many_WeekDays.dat", _ "c:/How_Many_WeekDays.dat" End Sub (you need the login for the site assuming it''s not public.) -- Lyle (for e-mail refer to http://ffdba.com/) 这篇关于你如何从Web服务器上获取文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-24 05:33