A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Highlighting specific words



 
 
Thread Tools Display Modes
  #21  
Old April 2nd, 2006, 03:23 AM posted to microsoft.public.word.docmanagement
external usenet poster
 
Posts: n/a
Default Highlighting specific words

Drats.

Go to ToolsTemplates and Add-Ins and uncheck the VBA Find and Replace
Add-in.

The open the template file itself and it should be viewable.


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


jezzica85 wrote:
One more thing, I went in and the VBA editor said the file was
unviewable. Did I do something wrong?

"Greg Maxey" wrote:

Ok,

Part of the problem is that you said you wanted to "highlight" text
not "change the color." The macro does not have a UI feature to
change font color (I might add it). However the code can easily be
adapted to change font color or practically anything else.

Open the template file and the press ALT+F11 to open the VB editor.
If not displayed, press CTRL+R to open the Project Explorer. You
will see a project named "VBA Find and Replace" If not explanded,
expand it an you will see a folder named Forms. Double click the
form named UserInterface. Either the form or the form code will
appear. If it is the form the right click UserInterface again and
select few code. Now using the right hand scrool bar, scrool down
in the code until you come to the last Function named:

Public Function SrchAndReplaceInStory ....

You are going to need to add a line of code.

The twelfth line down reads:
..Replacement.Text = ListArray(i, 2)

immediately after that line add this line:
..Replacement.Font.Color = wdColorRed

Using the file menu in the VB editor now save the project.

Ok, now for your error.

I just process a collection of forty differenct words and phrases
with no errors. Yes, 7000 may be too much for one bite and you
might have to do it in segments, however I don't know why you are
having errors at 15. Can you give me an example of the list of
words that you are using?




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


jezzica85 wrote:
OK, let's give it a shot. I made the word list in the predefined
words, with the find and replace columns identical except for the
replace column being red instead of black. What I want to do is
whenever a word in the find column appears in my document, I want to
replace it with the red version. The macro sort of seems to run if I
have a very small list of words, say 8 or 10, but it doesn't replace
with the red, it looks like it replaces with the same word, same
formatting, when I need the same word with the new formatting. If I
entered in anything more than 15 words, it would tell me that the
string parameter is too long. I've tried it so far in the
predefined list setting and the quicklist setting, and both of them
do that. Maybe 7000 words is just too long for the macro? It's
probably some small thing I'm doing wrong.

"Greg Maxey" wrote:

jezzica,
While I was napping John replied to your last post superbly ;-).
We need to establish exactly what it is that you are trying to do
and where in that process the macro falls short.

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

"jezzica85" wrote in message
...
Thanks for trying Greg, I redownloaded the macro and it still
won't work for
me. Maybe it's my computer.

"Greg Maxey" wrote:

That is odd. I just downloaded the template and gave it a try.
I typed: "One two three four five" in the document and then used
the "a Quicklist I
create now" option. I typed "One two three four five" in the
Find column and the Replace column, saved the file and close it.
Then checked "Highlight" and "Go".

Result: One two three four five was highlighted in the document.



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

"jezzica85" wrote in
message
...
As a matter of fact, I didn't ignore your suggestion, Greg. It
was the first
thing I tried, and it didn't work. The find and replace didn't
replace anything.

"Greg Maxey" wrote:

I have offered you a possible solution that so far you have
choosen to ignore. Provided you can define your list of 7000
words in a simple table
with the same 7000 words listed as both the find and replace
word as then
the Add-in will do it in fairly short order.

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


jezzica85 wrote:
I probably should have said this before (sheepish shrug) but I
have almost 7000 words to go through. Is there a way to do
them with AutoCorrect without needing to enter each one
individually?

"Suzanne S. Barnhill" wrote:

I don't think AutoCorrect will really do what you're thinking
about,
but see
http://word.mvps.org/faqs/customization/AutoCorrect.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to
the newsgroup so all may benefit.

"jezzica85" wrote in
message
...
Thanks John, but I can't seem to find this. Is it only in
certain versions of Word? I have XP.

"John McGhie [MVP - Word and Word Macinto" wrote:

Hi Jezzica:

Yes, you can do this with AutoCorrect.

Study the topic "Create an AutoCorrect entry to store and
automatically insert text and graphics" in the Help.

You need to enter the words you want to search for in your
AutoCorrect list, and replace them with the same word
highlighted.
Make sure you choose the "Formatted" options or the
highlighting won't come in.

Forget macros for this task. You would need to be a
seriously good
programmer to make a macro to do this. Ask Jezebel if s/he
will send you one, because I have never seen a macro that
could do this
with acceptable performance :-)

Hope this helps

On 1/4/06 2:08 PM, in article
,
"jezzica85" wrote:

That would be perfect! I have no idea how to write or use
macros, though, could you possibly direct me to one and
give me pointers on how to use it? Thanks!

"Jezebel" wrote:

You can't do *anything* automatically while you type,
other than
autocorrect which isn't going to help you here.

You could write a macro that reads words from a file or
table, searches for them in another document, and formats
them in a special way. Would that help?




"jezzica85" wrote
in message
...
Hi all, does anyone know, if you have a file of words
you want to keep track
of, if there's a way to automatically highlight those
words in another file,
or to put those words in a table in the other file, then
automatically highlight them as they're typed or they
already appear in the document? Thanks!




--

Please reply to the newsgroup to maintain the thread.
Please do not email me unless I ask you to.

John McGhie
Microsoft MVP, Word and Word for Macintosh. Consultant
Technical Writer Sydney, Australia +61 (0) 4 1209 1410



  #22  
Old April 2nd, 2006, 03:25 AM posted to microsoft.public.word.docmanagement
external usenet poster
 
Posts: n/a
Default Highlighting specific words

I don't have a large document or list to work with or troubleshoot. Yes,
sometimes I have found that my Word gets all tangled up when the files get
really big.

If you want, you can e-mail me your list and document and I will see if I
can determine what is going wrong.

I am basically a novice at VBA and there could be something fundametally
wrong with the code that causes it to generate your error. I just posted it
the other day and haven't heard any critical comments from the pros.


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

"jezzica85" wrote in message
...
Thanks, I'll definitely try this and see if it works. The words I'm using
are just normal ones, every now and then they might be hyphenated, but no
punctuation marks or special characters, like:

a
able
about
abruptly
absolutely
accept
accident
accused
across
act
acting
actively
actually
adamant
admit

Could there maybe be too many of them in the document?

"Greg Maxey" wrote:

Ok,

Part of the problem is that you said you wanted to "highlight" text not
"change the color." The macro does not have a UI feature to change font
color (I might add it). However the code can easily be adapted to change
font color or practically anything else.

Open the template file and the press ALT+F11 to open the VB editor. If
not
displayed, press CTRL+R to open the Project Explorer. You will see a
project named "VBA Find and Replace" If not explanded, expand it an you
will see a folder named Forms. Double click the form named
UserInterface.
Either the form or the form code will appear. If it is the form the
right
click UserInterface again and select few code. Now using the right hand
scrool bar, scrool down in the code until you come to the last Function
named:

Public Function SrchAndReplaceInStory ....

You are going to need to add a line of code.

The twelfth line down reads:
..Replacement.Text = ListArray(i, 2)

immediately after that line add this line:
..Replacement.Font.Color = wdColorRed

Using the file menu in the VB editor now save the project.

Ok, now for your error.

I just process a collection of forty differenct words and phrases with no
errors. Yes, 7000 may be too much for one bite and you might have to do
it
in segments, however I don't know why you are having errors at 15. Can
you
give me an example of the list of words that you are using?




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


jezzica85 wrote:
OK, let's give it a shot. I made the word list in the predefined
words, with the find and replace columns identical except for the
replace column being red instead of black. What I want to do is
whenever a word in the find column appears in my document, I want to
replace it with the red version. The macro sort of seems to run if I
have a very small list of words, say 8 or 10, but it doesn't replace
with the red, it looks like it replaces with the same word, same
formatting, when I need the same word with the new formatting. If I
entered in anything more than 15 words, it would tell me that the
string parameter is too long. I've tried it so far in the predefined
list setting and the quicklist setting, and both of them do that.
Maybe 7000 words is just too long for the macro? It's probably some
small thing I'm doing wrong.

"Greg Maxey" wrote:

jezzica,
While I was napping John replied to your last post superbly ;-). We
need to establish exactly what it is that you are trying to do and
where in that process the macro falls short.

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

"jezzica85" wrote in message
...
Thanks for trying Greg, I redownloaded the macro and it still won't
work for
me. Maybe it's my computer.

"Greg Maxey" wrote:

That is odd. I just downloaded the template and gave it a try. I
typed: "One two three four five" in the document and then used the
"a Quicklist I
create now" option. I typed "One two three four five" in the Find
column and the Replace column, saved the file and close it. Then
checked "Highlight" and "Go".

Result: One two three four five was highlighted in the document.



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

"jezzica85" wrote in message
...
As a matter of fact, I didn't ignore your suggestion, Greg. It
was the first
thing I tried, and it didn't work. The find and replace didn't
replace anything.

"Greg Maxey" wrote:

I have offered you a possible solution that so far you have
choosen to ignore. Provided you can define your list of 7000
words in a simple table
with the same 7000 words listed as both the find and replace
word as then
the Add-in will do it in fairly short order.

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


jezzica85 wrote:
I probably should have said this before (sheepish shrug) but I
have almost 7000 words to go through. Is there a way to do
them with AutoCorrect without needing to enter each one
individually?

"Suzanne S. Barnhill" wrote:

I don't think AutoCorrect will really do what you're thinking
about,
but see http://word.mvps.org/faqs/customization/AutoCorrect.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

"jezzica85" wrote in
message
...
Thanks John, but I can't seem to find this. Is it only in
certain versions of Word? I have XP.

"John McGhie [MVP - Word and Word Macinto" wrote:

Hi Jezzica:

Yes, you can do this with AutoCorrect.

Study the topic "Create an AutoCorrect entry to store and
automatically insert text and graphics" in the Help.

You need to enter the words you want to search for in your
AutoCorrect list, and replace them with the same word
highlighted.
Make sure you choose the "Formatted" options or the
highlighting won't come in.

Forget macros for this task. You would need to be a
seriously good
programmer to make a macro to do this. Ask Jezebel if s/he
will send you one, because I have never seen a macro that
could do this
with acceptable performance :-)

Hope this helps

On 1/4/06 2:08 PM, in article
,
"jezzica85" wrote:

That would be perfect! I have no idea how to write or use
macros, though, could you possibly direct me to one and
give me pointers on how to use it? Thanks!

"Jezebel" wrote:

You can't do *anything* automatically while you type, other
than
autocorrect which isn't going to help you here.

You could write a macro that reads words from a file or
table, searches for them in another document, and formats
them in a special way. Would that help?




"jezzica85" wrote in
message
...
Hi all, does anyone know, if you have a file of words you
want to keep track
of, if there's a way to automatically highlight those
words in another file,
or to put those words in a table in the other file, then
automatically highlight them as they're typed or they
already appear in the document? Thanks!




--

Please reply to the newsgroup to maintain the thread.
Please do not email me unless I ask you to.

John McGhie
Microsoft MVP, Word and Word for Macintosh. Consultant
Technical Writer Sydney, Australia +61 (0) 4 1209 1410






  #23  
Old April 2nd, 2006, 10:31 AM posted to microsoft.public.word.docmanagement
external usenet poster
 
Posts: n/a
Default Highlighting specific words

This Hilitext software can help. You can store all words that you want
to highlight in a file and this software will highlight them all
everywhere, in Word, Excel, Internet Explorer, FireFox etc. You can
turn the highlighting on and off with a hotkey as well. One of my
faves. You can download the free trial version from its website he
hhttp://www.fanix.com/hilitext.html.
--mark


jezzica85 wrote:
Hi all, does anyone know, if you have a file of words you want to keep track
of, if there's a way to automatically highlight those words in another file,
or to put those words in a table in the other file, then automatically
highlight them as they're typed or they already appear in the document?
Thanks!


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word should catalog misspelled words to study. rndthought General Discussion 38 January 23rd, 2008 11:53 PM
highlighting numerous words Jackie D General Discussion 4 March 7th, 2006 03:34 PM
Determine how many times all words are used in a doc [email protected] General Discussion 8 December 17th, 2005 01:04 PM
how do I find an average number of specific words in a column cashgrfx New Users 7 January 6th, 2005 04:44 PM
Tracking Specific Words dee General Discussion 1 January 5th, 2005 10:17 PM


All times are GMT +1. The time now is 05:15 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.