Excel 图片URL地址直接显示图片

Sub Test()
 Dim Rng As Range
 Dim Cell As Range
 Dim Index As Integer
 Dim Limit As Integer
 Dim Max As Integer
 Index = 27
 Limit = 25
 Max = Index + Limit
 Set Rng = Range("E" & Index & ":E" & Max)
 For Each Cell In Rng
 With Cell
 Application.ScreenUpdating = False
 Dim d As Object, str$
 Set d = New DataObject
 str = "<table><img src=""" + Cell + "?x-oss-process=image/resize,m_pad,h_120,w_120,color_eeeeee"" width=""100""></table>"
 d.SetText str
 d.PutInClipboard
 Range("E" & Index).Select
 Debug.Print "E" & Index & "->" & str
 ActiveSheet.PasteSpecial Format:="Unicode 文本", Link:=False, DisplayAsIcon:=False
 End With
 Index = Index + 1
 Next Cell
End Sub

发表评论