【发布时间】:2017-06-17 06:19:50
【问题描述】:
大家早上好!
所以我从extendoffice.com/documents/excel/1156-excel-insert-multiple-pictures.html 获取了这段代码,如下所示。
我想知道是否有人可以帮助我-
将所有照片导入“B 行”,而不是按列方式导入。 以及如何在“A 行”中的每个图像上方添加所述图像的“文件名”(即 excel_image2.jpg)。
感谢您提前提供的所有帮助!
Sub InsertPictures()
'Update 20140513
Dim PicList() As Variant
Dim PicFormat As String
Dim Rng As Range
Dim sShape As Shape
On Error Resume Next
PicList = Application.GetOpenFilename(PicFormat, MultiSelect:=True)
xColIndex = Application.ActiveCell.Column
If IsArray(PicList) Then
xRowIndex = Application.ActiveCell.Row
For lLoop = LBound(PicList) To UBound(PicList)
Set Rng = Cells(xRowIndex, xColIndex)
Set sShape = ActiveSheet.Shapes.AddPicture(PicList(lLoop), msoFalse, msoCTrue, Rng.Left, Rng.Top, Rng.Width, Rng.Height)
xRowIndex = xRowIndex + 1
Next
End If
End Sub
【问题讨论】:
-
什么是“B 行”?行有数字索引,列有字母索引