vb6.0/vba [vba] WinHttp 파일 다운로드
페이지 정보

본문
Sub program1472_com()
    Dim B() As Byte, FN As Long
    Dim URL As String
    Dim filePath As String, FileName As String
    Dim C As Range
    filePath = ThisWorkbook.Path & "\/"
    For Each C In Range("A2:A100")
        If InStr(C, "http") = 1 Then
            URL = C.Value
            FileName = Split(URL, "/")(UBound(Split(URL, "/")))
            With CreateObject("WinHTTP.WinHTTPrequest.5.1")
                .Open "GET", URL, False
                .Send
                .WaitForResponse: DoEvents
                '// debug.? .GetAllResponseHeaders
                B = .ResponseBody
            End With
            FN = FreeFile
            Open filePath + FileName For Binary Access Write As #FN
                Put #FN, 1, B
            Close #FN
        End If
    Next
    MsgBox "모든 작업이 완료되었씁니다."
End Sub
- 이전글[vb6.0/vba] WinHttp를 이용한 구글 이미지 검색 20.04.10
 - 다음글[vba] 엑셀(Excel) 셀 오른쪽 마우스 매뉴 20.03.17
 
댓글목록
등록된 댓글이 없습니다.



