How to count word from statistic option and exlude.... in Work200

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to count some word in doucumnets but I need to exclude all sentences
start with "[" and end with "]" and sentence start with ";".

is their smart way to exclude those sentances ?
 
There's no smart way I can think of, but a macro should do it - try the
following, which will count the section with the described sentences
eliminated then it will put them back and count the full document: -

ActiveWindow.View.ShowHiddenText = False
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ";*. "
.Replacement.Text = "^&"
.Replacement.Font.Hidden = True
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "\[*\]"
.Replacement.Text = "^&"
.Replacement.Font.Hidden = True
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
Selection.WholeStory

MsgBox "There are " & Selection.Words.Count & " words."
ActiveWindow.View.ShowHiddenText = True
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "*"
.Font.Hidden = True
.Replacement.Text = "^&"
.Replacement.Font.Hidden = False
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll
Selection.WholeStory

MsgBox "There are " & Selection.Words.Count & " words."
ActiveWindow.View.ShowHiddenText = False

If you don't know what to do with this listing, see
http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top