Sub Demo1()
Const A = "<a href=""../../", C = ">Archives<", D = "https://fbil.org.in/", T = "Download"
Dim L&, U$, N%, B() As Byte
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "GET", D & "modules/Archives/downloads.aspx", False
.setRequestHeader "DNT", "1"
On Error Resume Next
.send
L = .Status = 200
If L Then
L = InStr(.responseText, C)
If L Then
L = InStr(L, .responseText, A) + Len(A)
U = Replace(Mid(.responseText, L, InStr(L, .responseText, """") - L), "amp;", "")
.Open "GET", D & U, False
.setRequestHeader "DNT", "1"
.send
N = .Status = 200
On Error GoTo 0
If N Then
B = .responseBody
U = ThisWorkbook.Path & "\Samir79 " & Split(U, "=")(2)
N = FreeFile
Open U For Binary As #N
Put #N, , B
Close #N
MsgBox U, vbInformation, T & "ed from " & D
Else
MsgBox "Error", vbExclamation, T
End If
Else
MsgBox "No '" & C & "' in the webpage", vbExclamation, T & " aborted"
End If
Else
MsgBox "Can't reach the webpage", vbCritical, T
End If
End With
End Sub