Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
DD DD is offline
external usenet poster
 
Posts: 26
Default Word Find/Replace Options - wildcards & formatting changes

I still use an old word processor because it has wild card find/replace
options that I can't seem to duplicate in Word.

Example:
in this other wp, I can find: ^R^+ replace ^R^+ and set options that will
change the format from, for ex., italic to bold or from no formatting to
italic plus bold. The string in the example consists of anything following a
Return until & incl. a colon. The options allow me to specify the current
format - font/attribute etc. - and what I want the new format to be..

In other words, I want to change the formatting for strings that may contain
a variety of different characters but are bounded by a specific start and a
specific end. (Actually, this wp's find/replace w/ options lets me build
rather complex combinations of wildcards to which formatting changes may be
applied.)

I have been unable to figure out any way to do this in any version of Word.
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word Find/Replace Options - wildcards & formatting changes

Wildcards in Word are quite comprehensive -
http://www.gmayor.com/replace_using_wildcards.htm but you cannot format
*part* of a found string in Word directly. It is nevertheless simple enough
to do with a macro e.g.

Dim oRng As Range
With Selection
.HomeKey wdStory
'Look for a paragraph mark followed by text as far as a colon
Do While .Find.Execute("^13*:", MatchWildcards:=True)
'Mark the found text as a range
Set oRng = Selection.Range
With oRng
'Move the start of the range one character,
'to eliminate the paragraph mark
.Start = .Start + 1
'Add Italic formatting to the new range
.Italic = True
'Add Bold formatting
.Bold = True
End With
'And find the next matching string
Loop
End With

However the wildcard character '*' is a rather broad brush, so I would
prefer to tie down the search string rather more tightly than that as it
will find the next paragraph mark and the colon that follows it - regardless
of how many other paragraph marks there may be in between, which may not be
what is required. e.g.
Do While .Find.Execute("^13[a-zA-Z ]{1,}:", MatchWildcards:=True)

The linked page should help with the syntax.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



dd wrote:
I still use an old word processor because it has wild card
find/replace options that I can't seem to duplicate in Word.

Example:
in this other wp, I can find: ^R^+ replace ^R^+ and set options
that will change the format from, for ex., italic to bold or from no
formatting to italic plus bold. The string in the example consists
of anything following a Return until & incl. a colon. The options
allow me to specify the current format - font/attribute etc. - and
what I want the new format to be..

In other words, I want to change the formatting for strings that may
contain a variety of different characters but are bounded by a
specific start and a specific end. (Actually, this wp's find/replace
w/ options lets me build rather complex combinations of wildcards to
which formatting changes may be applied.)

I have been unable to figure out any way to do this in any version of
Word.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
find and replace numbers using wildcards Andy Microsoft Word Help 1 May 12th 07 07:42 PM
Using find and replace or wildcards to eliminate headers and such Joe Microsoft Word Help 3 April 26th 07 03:38 PM
Word Bug: Find/Replace wildcards while track changes is turned on is buggy [email protected] Microsoft Word Help 2 February 24th 06 09:35 AM
Find & Replace--Wildcards Joe McGuire Microsoft Word Help 6 February 16th 06 09:16 AM
Find/Replace Wildcards DeanH Microsoft Word Help 2 August 11th 05 09:44 AM


All times are GMT +1. The time now is 06:04 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"