【发布时间】:2019-08-12 12:50:44
【问题描述】:
我想将一个文件夹的所有图像一张一张地插入到 Excel 中的递增单元格中。
例如,图片1应该插入单元格E1,然后图片2插入单元格E2,等等
我的代码只能将此目录中的一张图片插入硬编码单元格中:
Sub Insert()
Dim myPict As Picture
Dim PictureLoc As String
PictureLoc = "C:\MyFolder\Picture1.png"
With Range("E1")
Set myPict = ActiveSheet.Pictures.Insert(PictureLoc)
.RowHeight = myPict.Height
myPict.Top = .Top
myPict.Left = .Left
myPict.Placement = xlMoveAndSize
End With
End Sub
【问题讨论】: