|
以下代码,需要把指定文件夹,改为可选择文件夹后,执行导入。求大神指点!
Sub 本地图库工具()
On Error Resume Next
Dim w
w = MsgBox("请确定你的图片是否放在E盘的^图库^文件夹下!" & vbNewLine & "并且图库文件夹下不能有子文件夹!" & vbNewLine & "图片只能是jpg格式!", vbYesNo, "本地图库使用前提示")
If w = vbNo Then
Exit Sub
End If
Dim MR As Range
For Each MR In Selection
If Not IsEmpty(MR) Then
MR.Select
ML = MR.Left
MT = MR.Top
MW = MR.Width
MH = MR.Height
ActiveSheet.Shapes.AddShape(msoShapeRectangle, ML, MT, MW, MH).Select
On Error Resume Next
Selection.ShapeRange.Fill.UserPicture _
"E:\图库\" & MR.Value & ".jpg"
End If
Next
End Sub
|
|