|
'你这照片文件名数字后面还有空格的
'输出在"数据"工作表,"打印"工作表很多编号没有,方法一样自己修改,,,
Option Explicit
Sub test()
Dim i, t, pth, rng
pth = ThisWorkbook.Path & "\"
With Sheets("数据")
For Each i In .Shapes
i.Delete
Next
For i = 2 To .Cells(Rows.Count, "b").End(xlUp).Row
If Len(.Cells(i, "b").Value) = 0 Then Exit For
t = pth & .Cells(i, "b").Value & ".JPG"
t = Replace(t, "(", " (")
If Len(Dir(t)) > 0 Then
Set rng = .Cells(i, "e")
With .Pictures.Insert(t)
.ShapeRange.LockAspectRatio = msoFalse
.Top = rng.Top + 1
.Left = rng.Left + 1
.Height = rng.Height - 1
.Width = rng.Width - 1
End With
End If
Next
End With
End Sub |
评分
-
2
查看全部评分
-
|