|
Sub test()
arr = [a1].CurrentRegion
Set fso = CreateObject("Scripting.FileSystemObject")
Application.ScreenUpdating = False
For Each shp In ActiveSheet.Shapes
If shp.Type = 13 Then shp.Delete
Next shp
For j = 2 To UBound(arr)
Set Rng = Cells(j, 4)
str1 = ThisWorkbook.Path & "\照片\" & arr(j, 1) & ".jpg"
If fso.FileExists(str1) Then
ActiveSheet.Pictures.Insert(str1).Select
With Selection
.ShapeRange.LockAspectRatio = msoFalse
.Left = Rng.Left + 1
.Top = Rng.Top + 1
.Width = Rng.Offset(0, 1).Left - Rng.Left - 2
w = Rng.Offset(1, 0).Top
y = Rng.Top
.Height = w - y - 2
End With
End If
Next j
Application.ScreenUpdating = True
End Sub
|
|