Reply
 
Thread Tools Display Modes
  #1   Report Post  
Adrian
 
Posts: n/a
Default Use macro to find in text box

I've recorded a macro in Word 2000 using Find All as this finds text in a
text box but when I run the macro, the text is not found. There seems to be
no Find All option for the Find or Execute commands.
--
Adrian
  #2   Report Post  
Graham Mayor
 
Posts: n/a
Default

There is a problem with the macro recorder and the search command. What is
it that you are trying to find?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Adrian wrote:
I've recorded a macro in Word 2000 using Find All as this finds text
in a text box but when I run the macro, the text is not found. There
seems to be no Find All option for the Find or Execute commands.



  #3   Report Post  
Adrian
 
Posts: n/a
Default

I am trying to find by Style Name and replace text in the stated style with
replacement text.
This is to populate a template with data. Cannot use mail merge fields as I
want header information at the top of the page and repeating information from
a datasheet, which would populate text in character styles in a document
table.
Hence, if data [Record ID] would populate the first found character style
called "Record ID".
The problem is there's no wdFindAll option !
--
Adrian Price


"Graham Mayor" wrote:

There is a problem with the macro recorder and the search command. What is
it that you are trying to find?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Adrian wrote:
I've recorded a macro in Word 2000 using Find All as this finds text
in a text box but when I run the macro, the text is not found. There
seems to be no Find All option for the Find or Execute commands.




  #4   Report Post  
Graham Mayor
 
Posts: n/a
Default

You need something like:

Sub ReplaceExample()

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
'**********************
.Style = "Record ID"
.Replacement.Text = "Your text here"
'**********************
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Adrian wrote:
I am trying to find by Style Name and replace text in the stated
style with replacement text.
This is to populate a template with data. Cannot use mail merge
fields as I want header information at the top of the page and
repeating information from a datasheet, which would populate text in
character styles in a document table.
Hence, if data [Record ID] would populate the first found character
style called "Record ID".
The problem is there's no wdFindAll option !

There is a problem with the macro recorder and the search command.
What is it that you are trying to find?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Adrian wrote:
I've recorded a macro in Word 2000 using Find All as this finds text
in a text box but when I run the macro, the text is not found.
There seems to be no Find All option for the Find or Execute
commands.



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
End/FootNote text style Shaun Page Layout 4 July 5th 05 04:36 PM
How do I turn select text on and use Find to select a block of te. hpmted Microsoft Word Help 2 April 13th 05 12:32 AM
How do I find my macro files for word so I can import them to my . hikingbarbiedoll Microsoft Word Help 1 March 2nd 05 10:50 PM
change all caps in text to small lettering using find and replace. Jackson State New Users 3 January 13th 05 06:41 AM
Should be simple! Macro to find italics won't run LizW Microsoft Word Help 2 November 30th 04 06:32 PM


All times are GMT +1. The time now is 05:21 AM.

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"