|
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Count > 1 Then Exit Sub
- If Target.Address <> "$H$1" Then Exit Sub
- Dim rng As Range, myPath$, shp
- Dim ML, MT, MW, MH
- myPath = ThisWorkbook.Path & "\相片"
- Set rng = Cells(3, 10).Resize(3, 1)
- With rng
- ML = .Left
- MT = .Top
- MW = .Width
- MH = .Height
- For Each shp In ActiveSheet.Shapes
- If shp.Type = msoAutoShape Then
- shp.Delete
- End If
- Next
- ActiveSheet.Shapes.AddShape(msoShapeRectangle, ML, MT, MW, MH).Select
- Selection.ShapeRange.Fill.UserPicture _
- myPath & [b6].Value & ".jpg"
- End With
- [b5].Select
- End Sub
复制代码 |
|