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 / September 2007

Tip: Looking for answers? Try searching our database.

I need IS NOT (<>) operand for Font.Name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jg0017 - 09 Sep 2007 16:20 GMT
In the sub below I need to make line six return 'true' on any OTHER font that
the one listed.  I've tried all the normal operands and nothing works.  

The sub purpose is to replace all fonts with one single font.

Thanks,

Mike

Sub ReplaceFont()
     With Selection.Find
        ' Clear all previously set formatting for Find dialog box.
        .ClearFormatting
        ' Set font to Find for replacement.
        .Font.Name = "Arial"
        ' Clear all previously set formatting for Replace dialog box.
        .Replacement.ClearFormatting
        ' Set font to Replace found font.
        .Replacement.Font.Name = "Times New Roman"
        ' Don't find or replace any text.
        .Text = ""
        .Replacement.Text = ""
        ' The following parameters must be set as follows
        ' to find only text formatted for the specified font.
      '  .Forward = True
      '  .Wrap = wdFindContinue
      '  .Format = True
      '  .MatchCase = False
      '  .MatchWholeWord = False
      '  .MatchWildcards = False
      '  .MatchSoundsLike = False
      '  .MatchAllWordForms = False
     End With
     ' Perform the find and replace.
     Selection.Find.Execute Replace:=wdReplaceAll
  End Sub
Greg Maxey - 09 Sep 2007 17:57 GMT
I don't think you can do it that way.

Maybe:

Sub ScratchMacro()
Dim oPar As Word.Paragraph
For Each oPar In ActiveDocument.Range.Paragraphs
 oPar.Range.Font.Name = "Times New Roman"
Next oPar
End Sub

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> In the sub below I need to make line six return 'true' on any OTHER font
> that
[quoted text clipped - 33 lines]
>      Selection.Find.Execute Replace:=wdReplaceAll
>   End Sub
 
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.