|
图片的代码:
- Sub lqxs()
- Dim ML, MT, MW, MH, shp As Shape, rng As Range
- Dim myPath$, myName$
- myPath = ThisWorkbook.Path & "\照片文件夹"
- myName = Dir(myPath & [e3].Value & ".jpg")
- If myName <> "" Then
- Set rng = [i1:i3]
- With rng
- ML = .Left
- MT = .Top
- MW = .Width
- MH = .Height
- For Each shp In ActiveSheet.Shapes
- If shp.Type = 13 Then
- If shp.TopLeftCell.Address = rng.Offset(0, 0).Address Then
- shp.Delete
- End If
- End If
- Next
- ActiveSheet.Shapes.AddShape(msoShapeRectangle, ML, MT, MW, MH).Select
- Selection.ShapeRange.Fill.UserPicture myPath & "" & [e3].Value & ".jpg"
- End With
- End If
- [a1].Select
- End Sub
复制代码 |
|