我想自动检查我的文档中的某些属性:
理想情况下,我想用评论来标记所有这些,所以我可以稍后修复它们。
这种文本测试是否可行/可行/已存在于单词中?
答案 0 :(得分:2)
不幸的是,您无法立即运行它,因为如果您需要某些标记,则无法突出显示隐藏的文档标记。尝试使用这两个子目标来实现不同的目标(也可以阅读subs中的一些注释)
Sub Searching_For_Text()
'will highlight all options added with .HitHighlight method
With ActiveDocument.Content.Find
.ClearHitHighlight
'words
.HitHighlight "Variant" 'any word this way
'any text
.HitHighlight " (" 'this for spaces before parenthesis
'partially specified text
.HitHighlight "doc" 'simply this for words like: _
document, documents
'option 2- this can't be highlighted but no error returned
.HitHighlight "^p" 'paragraph mark
.HitHighlight "^l" 'soft line mark
End With
End Sub
对于特殊文件标记:
Sub Searching_Special_marks()
'for paragraph marks you need to search each separately
'each time you call it you will find next one, next to current selection point
With Selection.Find
'some cleaning
.ClearFormatting
'searching each separately
.Text = "^p" '^l for soft lines, _
^t for tabs, etc.
.Forward = True
.Execute
End With
End Sub
我认为您需要对这些可能的解决方案进行一些实验。