|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub lqxs()
- Dim rng As Range, ML, MT, MW, MH, shp As Shape, n%, jg
- On Error Resume Next
- Sheet1.Activate
- For Each shp In ActiveSheet.Shapes
- If shp.Type = 1 Or shp.Type = 13 Then
- shp.Delete
- End If
- Next
- With Application.FileDialog(msoFileDialogOpen)
- .AllowMultiSelect = True
- .Show
- For i = 1 To .SelectedItems.Count
- filenm = .SelectedItems(i)
- myName = Dir(filenm)
- If myName <> "" Then
- ML = 54.75
- MT = 78.75
- MW = 277.5
- MH = 127.5: jg = 0
- n = n + 1
- If n > 3 Then n = 1: MT = MT + MH + jg: ML = 54.75
- ML = n * MW - 222.75
- ActiveSheet.Shapes.AddShape(msoShapeRectangle, ML, MT, MW, MH).Select
- Selection.ShapeRange.Fill.UserPicture myPath & myName
- End If
- Next
- End With
- Application.ScreenUpdating = True
- [a1].Select
- If Err.Number <> 0 Then Err.Clear: On Error GoTo 0
- End Sub
复制代码 打开对话框选择多个图片文件即可。 |
|