需要这样的代码......应该隐藏两个标签之间存在的数据......为此,我首先在文档中搜索标签,然后用注册的符号(®)替换该标签并获得那样的范围。我需要一个代码而不用替换标签
Sub Test()
Dim i As Long
i = 0
Dim myWord As String
myWord = "®"
TargetList = Array("</hidden>")
With ActiveDocument.Content.Find
.Text = "</hidden>"
.Replacement.Text = myWord
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
Counter = 1
Set Range = ActiveDocument.Range
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.Text = "<hidden>"
While .Execute
Counter = Counter + 1
Wend
End With
For i = 0 To Counter
Set Range = ActiveDocument.Range
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.Text = "<hidden>"
If .Execute(Forward:=True) = True Then
With Selection.Range
Selection.MoveEndUntil Cset:="®", Count:=wdForward
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Font.Hidden = True
End With
End If
End With
Next i
End Sub