我有一列列出了 .jpg 文件名。我想让实际的照片出现。我该怎么做?
答案1
假设 A 列包含文件规范.jpg文件如下:
C:\TestFolder\sample.jpg
然后这个小宏会将实际的图片放在 B 列中:
Sub PicturePlacer()
Dim s As String
Dim r As Range, rB As Range
For Each r In Intersect(Range("A:A"), ActiveSheet.UsedRange)
Set rB = r.Offset(0, 1)
s = r.Value
With ActiveSheet.Shapes
.AddPicture s, False, True, rB.Left, rB.Top, rB.Width, rB.Height
End With
Next r
End Sub