Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

selection.find.font.color NOT equal to red not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
frogman - 01 Dec 2005 14:20 GMT
 Why doesn't the <> or the =not(wdColorRed) work

'find and replace the the hidden text with double lined text
   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
   With Selection.Find
       .Text = ""
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = True
       .Font.Color <> wdColorRed
       .Font.Italic = False
       .Font.Hidden = True
       .Replacement.Font.Hidden = False
       .Replacement.Font.DoubleStrikeThrough = True
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
Tony Jollans - 01 Dec 2005 15:16 GMT
Word's Find just doesn't have that capability - only Microsoft could tell
you why.

--
Enjoy,
Tony

>   Why doesn't the <> or the =not(wdColorRed) work
>
[quoted text clipped - 14 lines]
>     End With
>     Selection.Find.Execute Replace:=wdReplaceAll
frogman - 01 Dec 2005 15:31 GMT
is the only way to get the results i want, to make it = to all the
colors but red?
Helmut Weber - 01 Dec 2005 16:04 GMT
Hi Frogman,

can you make any assumptions about the text?
If it is only about words or any other pattern,
which isn't red, then:

Sub FindNotRed()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
  .Text = "<*>"
  .MatchWildcards = True
  While .Execute
     If rDcm.Font.Color <> wdColorRed Then
        ' rDcm.Select ' for testing only
        rDcm.Font.Color = wdColorBlue
     End If
  Wend
End With
End Sub

You might have to redefine the range,
depending on what you do to it.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

frogman - 02 Dec 2005 16:17 GMT
thanks
Klaus Linke - 04 Jan 2006 19:12 GMT
Or you could search for red, and then do something with the ranges that
aren't matched?
You'd just need to store the Selection.End (Long variable) each time you
match red text, and do your stuff to the range from that position to
Selection.Start of the next match.

Klaus

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.