Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
find and replace numbers using wildcards | Microsoft Word Help | |||
Using find and replace or wildcards to eliminate headers and such | Microsoft Word Help | |||
Word Bug: Find/Replace wildcards while track changes is turned on is buggy | Microsoft Word Help | |||
Find & Replace--Wildcards | Microsoft Word Help | |||
Find/Replace Wildcards | Microsoft Word Help |