Sub 批注插图()
Dim cell As Range
Selection.ClearComments
For Each cell In Selection
If Dir("D:\新建文件夹\" & cell.Text & ".png") <> "" Then
With cell.AddComment
.Visible = True
.Text Text:=""
.Shape.Select True
Selection.ShapeRange.Fill.UserPicture "D:\新建文件夹\" & cell.Text & ".png"
.Shape.Width = 200 'Add these 2 statement
.Shape.Height = 300
cell.Offset(1, 0).Select
.Visible = False
End With
End If
Next
Exit Sub
err:
ActiveCell.ClearComments
MsgBox "未找到同名的JPG图片!", 64, "提示"
End Sub
我始终没有弄明白你的问题标题到底发生了什么?我完全使用你的代码进行了测试,结果完全没有问题。