excel插入图片链接,显示图片
Sub test()
Dim rg As Range, shp As Shape
Rem ---------------------------------------------------
Rem 清除图形对象
For Each shp In ActiveSheet.Shapes
shp.Delete
Next
Rem ---------------------------------------------------
Rem 按名称插入图片
Rem 下行代码,根据A列开始循环处理
Rem 遇到错误继续执行 Cells(Rows.Count, "A").End(3).Row
On Error Resume Next
For i = 2 To 8
Set rg = Cells(i, "K")
Rem 下面代码,添加矩形
ActiveSheet.Shapes.AddShape(msoShapeRectangle, rg.Left, rg.Top, rg.Width, rg.Height).Select
Rem 下面代码,在矩形内部用图片填充
Rem Selection.ShapeRange.Fill.UserPicture "E:\图片\" & rg.Offset(0, -1) & ".jpg"
Selection.ShapeRange.Fill.UserPicture rg.Offset(0, -1)
Next
End Sub