|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Option Explicit
Sub test()
Dim ar, i&, strFileName$, strPath$, shp As Shape, dic As Object
Application.ScreenUpdating = False
For Each shp In ActiveSheet.Shapes
If shp.Type = msoPicture Then shp.Delete
Next
Set dic = CreateObject("Scripting.Dictionary")
With [A1].CurrentRegion
ar = .Value
For i = 2 To UBound(ar)
Set dic(ar(i, 1)) = .Cells(i, 2)
Next i
strPath = ThisWorkbook.Path & "\"
strFileName = Dir(strPath & "*.xls*")
Do Until strFileName = ""
If strFileName <> ThisWorkbook.Name Then
With GetObject(strPath & strFileName)
For Each shp In .ActiveSheet.Shapes
If shp.Type = msoPicture Then
shp.Copy
If dic.exists(.ActiveSheet.[E3].Value) Then
With dic(.ActiveSheet.[E3].Value)
.Select
.Parent.Paste
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.Height = .RowHeight
End With
End If
Exit For
End If
Next
.Close False
End With
End If
strFileName = Dir
Loop
End With
Application.ScreenUpdating = True
Beep
End Sub
|
|