|
有很多个文件夹,里面有多张图片,需要将其插入到指定的位置;我是小白,自己东凑西拼的搞了一每次只能插入一个文件夹的图片,求大佬帮忙指导一下,如何一次性将不同文件夹的插入到指定位置,万分感谢。一下是小弟写的,求大佬帮帮我!
Sub 插图图片()
Dim file
Dim rn As Range
Dim n As Integer, i As Integer, rnw As Integer, rnh As Integer
Dim j As Shape
i = InputBox("插入哪一行", "请输入数字")
n = 2
Application.FileDialog(msoFileDialogFilePicker).Show
For Each file In Application.FileDialog(msoFileDialogFilePicker).SelectedItems
Set rn = Cells(i, n)
rnw = rn.Width
rnh = rn.Height
ActiveSheet.Shapes.AddPicture file, 0, 1, ActiveSheet.Cells(i, n).Left + 10, ActiveSheet.Cells(i, n).Top + 10, rnw - 20, rnh - 20
n = n + 1
Next file
End Sub
|
|