Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
mark20090901 mark20090901 is offline
external usenet poster
 
Posts: 2
Default find capitalized words and replace with a text

I need a macro that do this in MS Word 2007

in the selected part of text to:
- find any words whose all LETTERS are capitalized (so Canada for example
should not be found, but CANADA should be)
- and replaces all those instances with a text , for example string "HERE"

I wonder if anybody could help with that?

Mark

  #2   Report Post  
Posted to microsoft.public.word.newusers
Greg Maxey[_2_] Greg Maxey[_2_] is offline
external usenet poster
 
Posts: 668
Default find capitalized words and replace with a text

Mark,

Sub ScratchMacro()
Dim oRng As Word.Range
Set oRng = Selection.Range
With oRng.Find
.Text = "[A-Z]@"
.MatchWildcards = True
.Replacement.Text = "HERE"
.Execute Replace:=wdReplaceAll
End With
End Sub

Note "I" in your example will also be replaced with "HERE"



--
Greg Maxey

See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

"mark20090901" u54447@uwe wrote in message news:9b7a75bfa7243@uwe...
I need a macro that do this in MS Word 2007

in the selected part of text to:
- find any words whose all LETTERS are capitalized (so Canada for
example
should not be found, but CANADA should be)
- and replaces all those instances with a text , for example string
"HERE"

I wonder if anybody could help with that?

Mark



  #3   Report Post  
Posted to microsoft.public.word.newusers
Terry Farrell Terry Farrell is offline
external usenet poster
 
Posts: 2,904
Default find capitalized words and replace with a text

Well if you use Find and Replace to simply find ANY instance of canada
regardless of capitalisation and Replace it with Canada, then it should do
what you want. It doesn't matter that it will find Canada and replace it,
because it replaces it with Canada anyway. Just keep the F&R dead simple.

--
Terry Farrell - MSWord MVP

"mark20090901" u54447@uwe wrote in message news:9b7a75bfa7243@uwe...
I need a macro that do this in MS Word 2007

in the selected part of text to:
- find any words whose all LETTERS are capitalized (so Canada for
example
should not be found, but CANADA should be)
- and replaces all those instances with a text , for example string
"HERE"

I wonder if anybody could help with that?

Mark

  #4   Report Post  
Posted to microsoft.public.word.newusers
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default find capitalized words and replace with a text

He doesn't want to replace it with "Canada," though.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org

"Terry Farrell" wrote in message
...
Well if you use Find and Replace to simply find ANY instance of canada
regardless of capitalisation and Replace it with Canada, then it should do
what you want. It doesn't matter that it will find Canada and replace it,
because it replaces it with Canada anyway. Just keep the F&R dead simple.

--
Terry Farrell - MSWord MVP

"mark20090901" u54447@uwe wrote in message news:9b7a75bfa7243@uwe...
I need a macro that do this in MS Word 2007

in the selected part of text to:
- find any words whose all LETTERS are capitalized (so Canada for
example
should not be found, but CANADA should be)
- and replaces all those instances with a text , for example string
"HERE"

I wonder if anybody could help with that?

Mark


  #5   Report Post  
Posted to microsoft.public.word.newusers
mark20090901 mark20090901 is offline
external usenet poster
 
Posts: 2
Default find capitalized words and replace with a text

Thanks a lot, I appreciate your help!

In the meantime I found this macro is working OK for me. (my intention was to
change any word in the selected text to a big dot, word "Canada" was just an
example here.

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.Font
.Size = 18
.Bold = True
.Color = wdColorRed
End With
With Selection.Find
.Text = "[A-Z]*[A-Z]"
.Replacement.Text = " €¢ "
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.MoveDown Unit:=wdLine, Count:=1

Best regards,

Mark



  #6   Report Post  
Posted to microsoft.public.word.newusers
Octavio[_2_] Octavio[_2_] is offline
external usenet poster
 
Posts: 35
Default find capitalized words and replace with a text

When the new Windows 7 is expected to be on the retail stores for sale? Any
idea of the retail prices?

Will the Office Professional 2007 programs work well with it (I bet it will,
since they are from the same company. Any anticipated problems? Slowness
in old computers?)

"mark20090901" u54447@uwe wrote in message news:9b7a75bfa7243@uwe...
I need a macro that do this in MS Word 2007

in the selected part of text to:
- find any words whose all LETTERS are capitalized (so Canada for
example
should not be found, but CANADA should be)
- and replaces all those instances with a text , for example string
"HERE"

I wonder if anybody could help with that?

Mark

  #7   Report Post  
Posted to microsoft.public.word.newusers
Terry Farrell Terry Farrell is offline
external usenet poster
 
Posts: 2,904
Default find capitalized words and replace with a text

Public release of Win 7 is due 22 October. You can pre-order Win 7 Home
Premium from Tesco for £70 ( with double club card points) now - only while
stock last. There's going to be a triple home pack introductory offer coming
on the shelves shortly for a limited period pre-offer (£150). Search the
usual suspects such as Amazon for the best offers. Pre-ordering will be
cheaper.

It will run on any PC that runs Vista but better. I have no problems with it
running on a Netbook. If it can run on a Netbook designed for Win XP, then
it will run on most low powered compatible PCs. You can download the
Compatibility Checker from Microsoft. You'll also find full details of
version and upgrades available on the MS site.

--
Terry Farrell - MSWord MVP

"Octavio" wrote in message
...
When the new Windows 7 is expected to be on the retail stores for sale?
Any idea of the retail prices?

Will the Office Professional 2007 programs work well with it (I bet it
will, since they are from the same company. Any anticipated problems?
Slowness in old computers?)



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 & replace a word and change text color of found words Der Koalameister Microsoft Word Help 1 May 30th 08 08:02 PM
Find and Replace all words that have a certain value in them, not just the value itself. El Capitán de las Albondigas Microsoft Word Help 1 September 30th 07 02:27 AM
How do i find and replace words in parenthesis? Bob in Arizona Microsoft Word Help 5 September 1st 06 06:31 AM
Trying to replace words with fields using Find/Replace mbleyle Microsoft Word Help 2 March 29th 06 11:35 PM
Find/ Replace is auto-capping the words I want to replace with Graham Mayor Microsoft Word Help 8 January 27th 06 01:39 AM


All times are GMT +1. The time now is 02:53 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"