Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Change capitalized words to capitalized words and bold
I would like to change all capitalized words to be both capitalized and bol.
It has to be a macro since my document contains thousands of CAPITALIZED words. I would also like to delete any parenthesized phrase inside a pair of parenthesis , including the parenthesis that contains a a 4 digit number somewhere between the parenthesis. In other words I would like to set up a macro that would remove the entire parenthesis such as (born in 1989 to Martha and Stan) but not remove the phrase and pair of parenthesis such as (tall order for $1.95). -- Butch Cassidy |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Change capitalized words to capitalized words and bold
No macros needed; a wildcard search can do both of these.
-- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Elfego Baca" wrote in message ... I would like to change all capitalized words to be both capitalized and bol. It has to be a macro since my document contains thousands of CAPITALIZED words. I would also like to delete any parenthesized phrase inside a pair of parenthesis , including the parenthesis that contains a a 4 digit number somewhere between the parenthesis. In other words I would like to set up a macro that would remove the entire parenthesis such as (born in 1989 to Martha and Stan) but not remove the phrase and pair of parenthesis such as (tall order for $1.95). -- Butch Cassidy |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Change capitalized words to capitalized words and bold
No macros needed; a wildcard search can do both of these.
-- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Elfego Baca" wrote in message ... I would like to change all capitalized words to be both capitalized and bol. It has to be a macro since my document contains thousands of CAPITALIZED words. I would also like to delete any parenthesized phrase inside a pair of parenthesis , including the parenthesis that contains a a 4 digit number somewhere between the parenthesis. In other words I would like to set up a macro that would remove the entire parenthesis such as (born in 1989 to Martha and Stan) but not remove the phrase and pair of parenthesis such as (tall order for $1.95). -- Butch Cassidy |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Change capitalized words to capitalized words and bold
The first option is simple enough. The second less so. The wildcard function
is difficult (or impossible) to set up to differentiate between unknown strings containing numbers, some of which may be wanted and others not. The following however should do the trick. Option Explicit Sub BoldOrDelete() Dim orng As Range Dim vFindText Dim i As Long vFindText = Array("[A-Z]{2,}", "\(*\)") For i = 0 To UBound(vFindText) Set orng = ActiveDocument.Range With orng.Find .Text = vFindText(i) Do While .Execute(Forward:=True, _ MatchWildcards:=True) = True If i = 0 Then orng.Font.Bold = True Else If ContainsNum(orng) = True Then orng.Delete End If End If Loop End With Next End Sub Function ContainsNum(orng As Range) As Boolean Dim iCtr As Long For iCtr = 1 To Len(orng.Text) ContainsNum = IsDate("01/01/" & (Mid(orng.Text, iCtr, 4))) If ContainsNum = True Then Exit Function End If Next iCtr End Function http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Elfego Baca" wrote in message ... I would like to change all capitalized words to be both capitalized and bol. It has to be a macro since my document contains thousands of CAPITALIZED words. I would also like to delete any parenthesized phrase inside a pair of parenthesis , including the parenthesis that contains a a 4 digit number somewhere between the parenthesis. In other words I would like to set up a macro that would remove the entire parenthesis such as (born in 1989 to Martha and Stan) but not remove the phrase and pair of parenthesis such as (tall order for $1.95). -- Butch Cassidy |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Change capitalized words to capitalized words and bold
The first option is simple enough. The second less so. The wildcard function
is difficult (or impossible) to set up to differentiate between unknown strings containing numbers, some of which may be wanted and others not. The following however should do the trick. Option Explicit Sub BoldOrDelete() Dim orng As Range Dim vFindText Dim i As Long vFindText = Array("[A-Z]{2,}", "\(*\)") For i = 0 To UBound(vFindText) Set orng = ActiveDocument.Range With orng.Find .Text = vFindText(i) Do While .Execute(Forward:=True, _ MatchWildcards:=True) = True If i = 0 Then orng.Font.Bold = True Else If ContainsNum(orng) = True Then orng.Delete End If End If Loop End With Next End Sub Function ContainsNum(orng As Range) As Boolean Dim iCtr As Long For iCtr = 1 To Len(orng.Text) ContainsNum = IsDate("01/01/" & (Mid(orng.Text, iCtr, 4))) If ContainsNum = True Then Exit Function End If Next iCtr End Function http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Elfego Baca" wrote in message ... I would like to change all capitalized words to be both capitalized and bol. It has to be a macro since my document contains thousands of CAPITALIZED words. I would also like to delete any parenthesized phrase inside a pair of parenthesis , including the parenthesis that contains a a 4 digit number somewhere between the parenthesis. In other words I would like to set up a macro that would remove the entire parenthesis such as (born in 1989 to Martha and Stan) but not remove the phrase and pair of parenthesis such as (tall order for $1.95). -- Butch Cassidy |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
find capitalized words and replace with a text | New Users | |||
Microsoft Word - How can I automatically create a list of capitalized words and phrases? | Microsoft Word Help | |||
How do I exclude a word from always capitalized words? | Microsoft Word Help | |||
Search for CAPITALIZED words? | New Users | |||
How can I change capitalized text to small case without retyping? | Microsoft Word Help |