Public Function IsPicture(ByVal URL As String) As Boolean '画像ヘッダ判定 Dim req As MSXML2.IServerXMLHTTPRequest Set req = New MSXML2.ServerXMLHTTP req.open "GET", URL, False req.setRequestHeader "Range", "bytes=0-7" '(可能であれば)先頭8バイトだけをダウンロード req.send Dim img() As Byte img = req.responseBody ' IsPicture = False If UBound(img) >= 1 Then If img(0) = &HFF And img(1) = &HD8 Then IsPicture = True 'JPEG Exit Function End If End If If UBound(img) >= 3 Then If img(0) = &H89 And StrConv(MidB(img, 2, 3), vbUnicode) = "PNG" Then IsPicture = True 'PNG Exit Function End If End If If UBound(img) >= 5 Then If StrConv(LeftB(img, 6), vbUnicode) Like "GIF8[79]a" Then IsPicture = True 'GIF Exit Function End If End If End Function