Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #31  
Old 10-09-2017, 09:03 AM
Abiwoop Abiwoop is offline Find and highlight multiple words in MS Word document Windows 7 64bit Find and highlight multiple words in MS Word document Office 2010 64bit
Novice
 
Join Date: Oct 2017
Posts: 2
Abiwoop is on a distinguished road
Default Exceeding the allowed number of characters in one line

Hi macropod,

Incredible thank you for this macro!!! I only discovered macros today and your initial macro works incredibly well for my purpose (highlighting the specific mentions of companies that I need to check for and report).

Only since I have roughly 250 company names to check for in a single word doc, I exceed the StrFnd line symbol limit and the macro skips the preceding lines (connecting with " _ " didn't work of course).

Is there a way to fix that (without having 3 separate macros)? I looked into your suggestion to have data pulled from excel sheet (https://www.msofficeforums.com/word-...d-replace.html), but since it's my very first macro, can't see how to work it into your original HiLightList macro.

Thank you for sparking my interested in VBA and macros!

Abigail
Reply With Quote
  #32  
Old 10-09-2017, 01:13 PM
macropod's Avatar
macropod macropod is offline Find and highlight multiple words in MS Word document Windows 7 64bit Find and highlight multiple words in MS Word document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Abiwoop View Post
Only since I have roughly 250 company names to check for in a single word doc, I exceed the StrFnd line symbol limit and the macro skips the preceding lines (connecting with " _ " didn't work of course).

Is there a way to fix that (without having 3 separate macros)?
You could use:
Code:
StrFnd = "dog|cat|pig|horse|man|" & _
  "dogs|cats|pigs|horses|men"
or:
Code:
StrFnd = "dog|cat|pig|horse|man|"
StrFnd = StrFnd & "dogs|cats|pigs|horses|men"
Quote:
Originally Posted by Abiwoop View Post
I looked into your suggestion to have data pulled from excel sheet (https://www.msofficeforums.com/word-...d-replace.html), but since it's my very first macro, can't see how to work it into your original HiLightList macro.
The macro there would work just as well, with just the few minor mods needed to implement highlighting instead of text replacement.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #33  
Old 10-10-2017, 01:35 AM
Abiwoop Abiwoop is offline Find and highlight multiple words in MS Word document Windows 7 64bit Find and highlight multiple words in MS Word document Office 2010 64bit
Novice
 
Join Date: Oct 2017
Posts: 2
Abiwoop is on a distinguished road
Default

Fantastic! Thank you for such a prompt response and all your help!
Reply With Quote
  #34  
Old 06-12-2020, 09:53 AM
avelovilm avelovilm is offline Find and highlight multiple words in MS Word document Windows 10 Find and highlight multiple words in MS Word document Office 2016
Novice
 
Join Date: Jun 2020
Posts: 2
avelovilm is on a distinguished road
Default

Hey Macropod,

Thank you for this amazing code, it has saved me hours of work.

I know it has been a while since your last response, but the code doesn't seem to identify words that are in headers, footers, and text boxes.

I found that word documents are broken down into 17 stories.
Mastering VBA for Microsoft Office 2013 - Richard Mansfield - Google Books

What changes can be made in order for the macro to catch words in some or all of the stories?

Thanks,
Ariana
Reply With Quote
  #35  
Old 06-12-2020, 02:50 PM
macropod's Avatar
macropod macropod is offline Find and highlight multiple words in MS Word document Windows 7 64bit Find and highlight multiple words in MS Word document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

That's because the code was written only to process content in the document body. To process content in all StoryRanges, see, for example:
https://www.msofficeforums.com/90012-post4.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #36  
Old 06-15-2020, 08:10 AM
avelovilm avelovilm is offline Find and highlight multiple words in MS Word document Windows 10 Find and highlight multiple words in MS Word document Office 2016
Novice
 
Join Date: Jun 2020
Posts: 2
avelovilm is on a distinguished road
Default

Thank you very much!
Reply With Quote
  #37  
Old 10-06-2020, 06:56 PM
bolejj bolejj is offline Find and highlight multiple words in MS Word document Windows 10 Find and highlight multiple words in MS Word document Office 2013
Novice
 
Join Date: Oct 2020
Posts: 1
bolejj is on a distinguished road
Default

Thx for providing the macro and continued support. I've been looking to do this for a long time. The macro is just what I needed.
Reply With Quote
  #38  
Old 09-22-2021, 12:04 PM
lucinf lucinf is offline Find and highlight multiple words in MS Word document Windows 10 Find and highlight multiple words in MS Word document Office 2016
Novice
 
Join Date: Sep 2021
Posts: 1
lucinf is on a distinguished road
Thumbs up The same macro doesn't work on a device, but works on another

Hey Macropod,

I found your macro, and I was struggling to make it to work on my device. Finally, I tested it on another device, and it worked. Then, I made the same steps on the first one and still not working. I checked all security settings, and they are the same. Any idea why the macro might still not work on my device?

Thank you a lot!

Later edit: I decided to record a random macro to see if it runs. I ran the new Macro, it worked and then ran the other macro and worked as well. Pretty strange, but finally solved.
Thank you for providing this valuable code!
Reply With Quote
Reply

Tags
find, highlight, multiple keywords

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and highlight multiple words in MS Word document Lost Word Document and cant find it!!! I saved it but it ISNT there!! APAV Word 9 10-09-2017 01:17 PM
Highlight text and find next instance DrDOS Word 0 11-15-2010 04:02 PM
Lock words in a document, but allow for input within the document tlinde Word 1 02-09-2010 09:07 PM
FInd recurring words in Word 2003 NJ007 Word 4 01-25-2010 03:11 PM
find - reading highlight - highlight all / highlight doesn't stick when saved bobk544 Word 3 04-15-2009 03:31 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:51 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft