A
avkokin
There is text which has some words (and phrases) which enclosure
brackets. Example: "Some text (has has) words.".
I need to change text within brackets (exclude brackets) to space. I
use follow code (below), but I can't insert space into brackets. Help
me, please.
N.B. Of course, I can simply using dialog Find and Replace, but I want
to do it by this code and with range. Thank you very much.
My code:
Sub delText()
Dim oRange As Range
Dim dt As String
'Set oRange = ActiveDocument.Range
Selection.HomeKey wdStory
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "\(*\)"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
While .Execute
Selection.MoveStart Unit:=wdCharacter, Count:=1
Selection.MoveLeft wdCharacter, 1, wdExtend
Selection.Delete
Wend
End With
Selection.HomeKey wdStory
End Sub
brackets. Example: "Some text (has has) words.".
I need to change text within brackets (exclude brackets) to space. I
use follow code (below), but I can't insert space into brackets. Help
me, please.
N.B. Of course, I can simply using dialog Find and Replace, but I want
to do it by this code and with range. Thank you very much.
My code:
Sub delText()
Dim oRange As Range
Dim dt As String
'Set oRange = ActiveDocument.Range
Selection.HomeKey wdStory
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "\(*\)"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
While .Execute
Selection.MoveStart Unit:=wdCharacter, Count:=1
Selection.MoveLeft wdCharacter, 1, wdExtend
Selection.Delete
Wend
End With
Selection.HomeKey wdStory
End Sub