我在文档中有很多链接,并且正在尝试编写代码以使用某个单词替换所有ActiveDocument.Path。但是,以下代码似乎不将ActiveDocument.Path识别为输入。任何建议都将不胜感激。
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ActiveDocument.Path
.Replacement.Text = "xxx"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAl
End Sub
答案 0 :(得分:0)
尝试将activedocument.path插入到文档中,然后手动检查实际文本的错误。 运行此命令以查看实际路径,然后如果显示正常,则休息很容易。
Sub test()
ActiveDocument.Range.Collapse wdCollapseStart
ActiveDocument.Range.InsertBefore ActiveDocument.Path
End Sub