Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-06-2019, 07:45 AM
RavindraBanthia RavindraBanthia is offline Looking for a VBA script that can locate one or more words in the same sentence Windows 10 Looking for a VBA script that can locate one or more words in the same sentence Office 2007
Advanced Beginner
Looking for a VBA script that can locate one or more words in the same sentence
 
Join Date: Jan 2019
Posts: 33
RavindraBanthia is on a distinguished road
Default Looking for a VBA script that can locate one or more words in the same sentence

Hi,



I am trying to find a VBA script that can locate sentences that contain one or more specified words in the same sentence and then highlight those sentences or write that sentence to another Word file.

I have already looked at the excellent sites maintained by Greg Maxey and Graham Mayor but could find a match.

Can anyone help please?

Best regards,
Ravindra
Reply With Quote
  #2  
Old 01-06-2019, 01:23 PM
macropod's Avatar
macropod macropod is offline Looking for a VBA script that can locate one or more words in the same sentence Windows 7 64bit Looking for a VBA script that can locate one or more words in the same sentence 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

The fundamental problem you'll have with that is that VBA has no idea what a grammatical sentence is. For example, consider the following:
Mr. Smith spent $1,234.56 at Dr. John's Grocery Store, to buy: 10.25kg of potatoes; 10kg of avocados; and 15.1kg of Mrs. Green's Mt. Pleasant macadamia nuts.
For you and me, that would count as one sentence; for VBA it counts as 5 sentences.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-06-2019, 07:05 PM
RavindraBanthia RavindraBanthia is offline Looking for a VBA script that can locate one or more words in the same sentence Windows 10 Looking for a VBA script that can locate one or more words in the same sentence Office 2007
Advanced Beginner
Looking for a VBA script that can locate one or more words in the same sentence
 
Join Date: Jan 2019
Posts: 33
RavindraBanthia is on a distinguished road
Default

Thank you, Paul.

Yes, sentence extraction is a problem.

Greg Maxey does have this though:

https://gregmaxey.com/word_tip_pages...sentences.html

Best regards,
Ravindra
Reply With Quote
  #4  
Old 01-06-2019, 09:07 PM
macropod's Avatar
macropod macropod is offline Looking for a VBA script that can locate one or more words in the same sentence Windows 7 64bit Looking for a VBA script that can locate one or more words in the same sentence 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

Yes, but note the caveats Greg's given. As I haven't used the addin, I can't say whether it might be applied to your needs.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 01-06-2019, 09:20 PM
RavindraBanthia RavindraBanthia is offline Looking for a VBA script that can locate one or more words in the same sentence Windows 10 Looking for a VBA script that can locate one or more words in the same sentence Office 2007
Advanced Beginner
Looking for a VBA script that can locate one or more words in the same sentence
 
Join Date: Jan 2019
Posts: 33
RavindraBanthia is on a distinguished road
Default

Well, I hope some reasonably reliable solution is found.
Reply With Quote
Reply

Tags
parser, vba, words

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for a VBA script that can locate one or more words in the same sentence Find a sentence that starts with certain words and change the style MAHE Word VBA 2 02-26-2018 08:40 AM
Looking for a VBA script that can locate one or more words in the same sentence A sentence where choice words are updated when the root word changes. Cacique Word 1 02-10-2017 10:11 AM
Adapt a script used in Word to highlight words, to work in Outlook? flatop Outlook 5 07-15-2014 01:07 PM
Looking for a VBA script that can locate one or more words in the same sentence Delete does not bring second sentence closer to first sentence Andoheb Word 29 07-03-2014 01:48 PM
Looking for a VBA script that can locate one or more words in the same sentence How to mark underlined words in a sentence as A, B, C, D (beneath the words) thudangky Word 13 12-12-2013 02:22 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:55 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