Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Download files using MSXML2.XMLHTTP

i am having a little trouble downloading a file using MSXML2.XMLHTTP

the code below works great *if* you can get a link that leads directly to
the file, as in the example below

Quote:
Private Sub test()
Dim objHTTP As Object
Set objHTTP = CreateObject("MSXML2.XMLHTTP")
Dim stl As String
Dim rt

stl = "http://slmap.hostingweb.us/test/1.zip"
objHTTP.Open "GET", stl, False, "test", "test" 'unme/pwd

objHTTP.send
rt = objHTTP.responseBody

Dim oADOStream
Set oADOStream = CreateObject("ADODB.Stream")
oADOStream.Type = 1
oADOStream.Mode = 3
oADOStream.Open
oADOStream.Write rt
oADOStream.SaveToFile "c:\anyfilename.zip"
oADOStream.Close
Set oADOStream = Nothing

Set objHTTP = Nothing
End Sub

unfortunately it 'freezes' when trying to pull a file from a different sort
of link, something like:

http://anysite.com/231/en-us/abc/gog...3&saveas=1.zip

i think it freezes because the link wants to open a dialogue box or
something. i have tried to retool the link, or find another one that is
directly connected to the file, but on some of these monster servers with the
way they deal with uploads and downloads the best i can do is the link i just
showed. it is one of those email attachement links.

has anybody had any experience with this?

using a webbrowser you can navigate to the link, but the webbrowser is
generlaly much slower so i want to go the MSXML2.XMLHTTP route if possible.
it has been working great for just about everything, but i ran into this snag
and need some help.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow download of .xls files Tschurin Excel Discussion (Misc queries) 3 January 26th 09 07:00 PM
MSXML2.XMLHTTP clear excel cache/memory (?) p3plyr Excel Programming 3 March 21st 07 10:15 AM
download to be able to save files as CSV in Excel? BrianH Excel Discussion (Misc queries) 1 December 22nd 04 03:11 AM
Can Excel download files? elbalazo Excel Programming 2 August 24th 04 07:14 PM
Download files with excel Mangda Excel Programming 0 October 14th 03 09:08 AM


All times are GMT +1. The time now is 09:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"