PDA

View Full Version : Solved: download files from internet thruugh VBA



anandbohra
10-10-2009, 12:06 AM
http://notices.bseindia.com/NoticesDownloads/20030124/Dly20030124.zip http://notices.bseindia.com/NoticesDownloads/20030125/Dly20030125.zip http://notices.bseindia.com/NoticesDownloads/20030126/Dly20030126.zip http://notices.bseindia.com/NoticesDownloads/20030127/Dly20030127.zip http://notices.bseindia.com/NoticesDownloads/20030128/Dly20030128.zip http://notices.bseindia.com/NoticesDownloads/20030129/Dly20030129.zip http://notices.bseindia.com/NoticesDownloads/20030130/Dly20030130.zip http://notices.bseindia.com/NoticesDownloads/20030131/Dly20030131.zip

the above data lies in from column B from b1 to b100
if I click this link i can download the file
but I want a loop in VBA which automatically download & save the files

Sub Macro1()

Dim i As Integer
For i = 1 To 50
Range("B" & i).Select
On Error Resume Next
Selection.Hyperlinks(i).Follow NewWindow:=False, AddHistory:=True
Next i
End Sub

but it wont download all files after first file it gives error (the reason to put on error resume next statement is that it might be possible that some days notices are not available on BSE site)

hope u r clear & try to solve my problem (I want to download notices form 31-03-2003)

Regards


Anand Bohra

MaximS
10-11-2009, 07:19 AM
hey Anand,

why not to use a flashget program?

you can copy/paste all the links in one go without the risk.

anandbohra
10-11-2009, 09:52 PM
Thanks MaximS
Actually I was so stick to VBA :banghead:
that literally failed to think about alternate source :dunno

thanks problem solved
all files are in queue to download :rotlaugh: