xcel VBA 可以練習抓取網路上的資料圖片 的 URL
Private Sub CommandButton1_Click()
Dim picture As String
picture = "http://www.example.com/aaa.jpg"
ActiveSheet.Pictures.Insert(picture)
End Sub
Would you please kindly teach me how to solve the following problems?
Thank you in advance,
VBA CODE:
Sub CommandBunClick()
Dim picture As String
picture = "https://i.pinimg.com/236x/39/eb/1d/39eb1dc594a91c4c1280dcf9d1b1237f.jpg"
ActiveSheet.Pictures.Insert (picture) 'successed
picture = "https://i.pinimg.com/236x/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.jpg"
ActiveSheet.Pictures.Insert (picture) 'successed
' picture = "https://i.pinimg.com/236x/39/eb/1d/39eb1dc594a91c4c1280dcf9d1b1237f.jpg 1x"
' Fail 'ActiveSheet.Pictures.Insert (picture)
picture = "https://i.pinimg.com/236x/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.jpg 1x, https://i.pinimg.com/474x/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.jpg 2x, https://i.pinimg.com/736x/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.jpg 3x, https://i.pinimg.com/originals/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.png 4x"
' Fail 'ActiveSheet.Pictures.Insert (picture)
srcSet = "https://i.pinimg.com/236x/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.jpg 1x, https://i.pinimg.com/474x/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.jpg 2x, https://i.pinimg.com/736x/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.jpg 3x, https://i.pinimg.com/originals/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.png 4x"
picture = srcSet
' Fail ' ActiveSheet.Pictures.Insert (picture)
picture = "https://i.pinimg.com/236x/39/eb/1d/39eb1dc594a91c4c1280dcf9d1b1237f.jpg 2x"
' Fail 'ActiveSheet.Pictures.Insert (picture)
picture = "https://i.pinimg.com/236x/39/eb/1d/39eb1dc594a91c4c1280dcf9d1b1237f.jpg 3x"
' Fail 'ctiveSheet.Pictures.Insert (picture)
End Sub
The original code of HTML page:
The original code of HTML page:
**Hi. Ahfuyeuem,
請問此URL,抓圖 : 程式如何寫才能成功抓圖? (不好意思, 麻煩您了)
picture = "https://i.pinimg.com/236x/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.jpg 1x, https://i.pinimg.com/474x/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.jpg 2x, https://i.pinimg.com/736x/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.jpg 3x, https://i.pinimg.com/originals/e7/26/d4/e726d4056bd1b77d66399a94c701d5a2.png 4x"
' Fail 'ActiveSheet.Pictures.Insert (picture)
**