Excel 打开网页并保存图像

Excel 打开网页并保存图像,excel,vba,web,Excel,Vba,Web,我目前正在使用以下VBA代码在IE上打开网站: Set IE = CreateObject("internetexplorer.application") IE.Visible = True IE.Navigate "http://test.com" 我现在需要从网站下载一张.gif格式的图像,其来源如下(使用inspect元素): 有什么建议吗?请使用urlmon的URLDownloadToFile函数,关于该函数的教程太多了,我需要及时在页面上显示图像,它是一个动画gi

我目前正在使用以下VBA代码在IE上打开网站:

Set IE = CreateObject("internetexplorer.application")
    IE.Visible = True
    IE.Navigate "http://test.com"
我现在需要从网站下载一张.gif格式的图像,其来源如下(使用inspect元素):



有什么建议吗?

请使用urlmon的URLDownloadToFile函数,关于该函数的教程太多了,我需要及时在页面上显示图像,它是一个动画gif,每次重新加载页面时都会重置。在@milevyo的回复后,会发现许多有希望的页面。你试过调查那件事吗?另外,请参阅下载文件页面。您所说的实时图像是什么意思?。每个实例上的图像或动画gif?
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" ( _
ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long





Private Sub Command1_Click()
    Dim sin As String
    Dim sout As String

    Dim ret As Long

    sin = "https://upload.wikimedia.org/wikipedia/commons/0/0e/Balle.gif"
    sout = Environ("HOMEPATH") & "\Desktop\" & "image.gif"

    ret = URLDownloadToFile(0, sin, sout, 0, 0)
    If (ret = 0) Then MsgBox "Succedded" Else MsgBox "failed"
End Sub
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" ( _
ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long





Private Sub Command1_Click()
    Dim sin As String
    Dim sout As String

    Dim ret As Long

    sin = "https://upload.wikimedia.org/wikipedia/commons/0/0e/Balle.gif"
    sout = Environ("HOMEPATH") & "\Desktop\" & "image.gif"

    ret = URLDownloadToFile(0, sin, sout, 0, 0)
    If (ret = 0) Then MsgBox "Succedded" Else MsgBox "failed"
End Sub