View Single Post
  #6   Report Post  
Steved
 
Posts: n/a
Default

Hello Jay from Steved

Thankyou very much.

"Jay Freedman" wrote:

Hi Steved,

Replace your macro with this one (notes below):

Sub Tc()
Selection.HomeKey wdStory
With Selection.Find
.Text = "T("
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False

Do While .Execute
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.Bold = True
Selection.Collapse wdCollapseEnd
Loop
End With
End Sub

The changes:

- Start by moving the Selection to the start of the document
(.HomeKey) and change the .Wrap to wdFindStop. The effect of this is
that the search will run all the way through the document once,
instead of looping around from the end back to the beginning.

- Replace the single .Execute statement with the Do While ... Loop to
repeat the search until no more hits appear. The way this works is
that the .Execute method returns a True value when it finds the .Text,
but returns False (thus stopping the loop) when it fails to find it.

- Add the .Collapse call. This collapses the Selection to an insertion
point at the end of its current location, so the next search starts
there rather than at the beginning of the current selection (in which
it would find the hit that it just finished processing).

- Change the .Bold = wdToggle to .Bold = True -- I assume you want it
to be bold even if it was already bold, while wdToggle would change
bold to not-bold.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

On Sat, 17 Sep 2005 20:45:02 -0700, Steved
wrote:

Hell from Steved

Below is my code Just need it to be modified to do the whole document please.

Sub Tc()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "T("
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.Bold = wdToggle
End Sub


"Steved" wrote:

Hello Jay from Steved

I simply meant end of Line. You posed a good question I have to go away and
think about it

Thankyou.

"Jay Freedman" wrote:

On Sat, 17 Sep 2005 19:41:02 -0700, Steved
wrote:

Hello from Steved

How do I please

Find, T( then highlight to the end of Row then bold it.

Thankyou

Use a wildcard search/replace -- see
http://www.gmayor.com/replace_using_wildcards.htm.

First be clear about what you're asking for: when you say "row", do
you mean a line (without a paragraph mark at the end), a paragraph
(with a paragraph mark at the end, visible as ΒΆ when you click the
Show All button), or a table row? The entries you make in the Replace
dialog are different...

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org