vba - Microsoft Word VBA 宏读取注释
问题描述
我正在尝试使用以下代码阅读文档中数字的注释
For Each iShp In .InlineShapes
iShp.Select
If Selection.Comments.Count > 0 Then
MsgBox Selection.Comments(1).Range.text
End If
Next
形状选择正确,但计数始终为 0...
我错过了什么?
解决方案
这是阅读所有评论的另一种方法:
Option Explicit
Sub DisplayCommentText()
With ActiveDocument
Dim cmt As Comment
For Each cmt In .Comments
Debug.Print cmt.Range.Text
Next cmt
End With
End Sub
推荐阅读
- php - 使用ajax将数据发送到codeigniter控制器
- r - 如何在ggplot2中翻转geom_curve(箭头)?
- sql-server - 如何改进此实体框架查询
- javascript - 使用 JS 为特定输入插入图像
- python - 测量灰度图像的平滑度
- javascript - 绕过 Chrome DevTools 或类似工具的 Javascript 无限循环
- php - 尝试在 ACF [wordpress] 中保存 sub_sub_field
- sql - PostgreSQL:无法将 JSON 转换为行结果
- java - 如何在运行时测试可选模块是否存在
- python-3.x - Discord.py 不会响应我的 if 语句