Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Terry Terry is offline
external usenet poster
 
Posts: 79
Default Using VBA Find to find text in a specific format

I'm trying to write VBA code that will find the next instance of text in a
specific format. The script below works for font.name ="Arial" and font.name
="Times New Roman", but for some reason it refuses to work for font.name =
"Courier" or font.name = "Courier New". Any ideas? Thanks in advance.

ActiveDocument.Activate
With Selection.Find
.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Font.Name = "Times New Roman"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False

End With
Selection.Find.Execute


End Sub




  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Helmut Weber Helmut Weber is offline
external usenet poster
 
Posts: 139
Default Using VBA Find to find text in a specific format

Hi Terry,

try to use

..Font.NameAscii = "Courier New"

Why?

I don't know.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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


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
Header with picture or text box Scott Page Layout 15 April 28th 23 02:52 AM
Creating dynamic cross reference links in a Word document torajudo Microsoft Word Help 5 April 27th 23 08:57 PM
Arcane Question @ Text Boxes & "Frames" Elmer Page Layout 12 August 14th 06 08:34 AM
manipulating/cutting/pasting text out of a text box [email protected] Microsoft Word Help 10 July 9th 06 10:54 PM
how do i automatically format specific text e.g apply a custom col docmarkh Microsoft Word Help 2 April 3rd 05 08:35 AM


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