|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 zjdh 于 2014-8-3 19:11 编辑
你再试试
Private Sub CommandButton1_Click()
On Error Resume Next
Dim rngTemp As Range, k As Range, shpPic As Picture
filepath = ThisWorkbook.Path & "\"
Set rngTemp = Application.InputBox("图片插入区域:", "选择单元格", Type:=8)
For Each k In rngTemp
With k
Filename = Dir(filepath & .Value & "*.jpg")
If k <> "" Then ActiveSheet.Shapes.AddPicture filepath & Filename, False, True, .Left, .Top, .Width, .Height
If Dir(filepath & .Value & ".jpg") <> "" Then
.ClearComments
.AddComment
.Comment.Shape.Fill.UserPicture filepath & "\" & .Value & ".jpg"
.Comment.Shape.Height = 240
.Comment.Shape.Width = 320
End If
End With
Next
End Sub
|
|