Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Elfego Baca Elfego Baca is offline
external usenet poster
 
Posts: 14
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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

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 capitalized words and replace with a text mark20090901 New Users 6 September 2nd 09 03:33 PM
Microsoft Word - How can I automatically create a list of capitalized words and phrases? Kavi Microsoft Word Help 2 February 4th 07 09:48 AM
How do I exclude a word from always capitalized words? Brian Microsoft Word Help 8 July 11th 05 06:14 PM
Search for CAPITALIZED words? Pop New Users 2 April 11th 05 09:53 PM
How can I change capitalized text to small case without retyping? washarp Microsoft Word Help 1 February 13th 05 09:21 PM


All times are GMT +1. The time now is 03:54 PM.

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"