1、首先在开发工具中打开VBA编辑器

2、在单元格区域当中输入一些内容作为例子

3、在VBA编辑器中插入模块

4、在模块当中输入如下代码,然后运行
Sub 插入图片标注()
Dim pizhu, pic As String
Set pizhu=ActiveCell.Comment
If Not pizhu Is Nothing Then ActiveCell.Comment.Delete '已有批注则删除批注
Set pizhu=Nothing '释放变量
pic=Application.GetOpenFilename(ImgFileformat) '提取图片文件
If pic="False" Then End '选择取消则退出程序
With ActiveCell
.AddComment '添加批注
.Comment.Visible=False '批注不可见
.Comment.Shape.Fill.Transparency=0# '批注不透明
.Comment.Shape.Fill.UserPicture pic '填充图片
.Comment.Shape.LockAspectRatio=msoTrue '设定图片透明度
.Comment.Shape.Height=30# '设定批注高度为30
End With
ActiveCell.Select
'设置图片比例,高与宽之比为3∶4
ActiveCell.Comment.Shape.ScaleWidth 3, msoFalse, msoScaleFromTopLeft
ActiveCell.Comment.Shape.ScaleHeight 4, msoFalse, msoScaleFromTopLeft
End Sub

5、选择照片,并单击“确定”按钮返回工作表,单元格A3即已完成图片批注的插入
