|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
请测试:- Sub 添加小图片批注()
- Dim arr, p$, i&
- p = "E:\商品图"
- ' p = ThisWorkbook.Path & "\商品图"'调试用
- arr = Range("d1:d" & Cells(Rows.Count, 4).End(3).Row)
- Call 删除批注宏
- For i = 5 To UBound(arr)
- MyPic = p & arr(i, 1) & ".jpg"
- If Dir(MyPic) <> "" Then
- With Cells(i, 4)
- .AddComment
- .Comment.Shape.Fill.UserPicture MyPic
- .Comment.Shape.Height = 140
- .Comment.Shape.Width = 140
- End With
- End If
- Next
- End Sub
- Sub 删除批注宏()
- Columns("D:D").ClearComments '删除批注
- End Sub
复制代码 |
|