Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-06-2014, 10:39 PM
macropod's Avatar
macropod macropod is offline Macro Question: Need help making a macro to highlight the first word in every sentence Windows 7 64bit Macro Question: Need help making a macro to highlight the first word in every sentence Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,525
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

Unfortunately, no. That's because Word's 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...

That said, a wildcard Find expression can be used to identify potential candidates, where:
Find = [.\!\?][^13^l ]<[A-Z]*>
This expression finds any period, exclamation mark or question mark followed by a space, paragraph-break or line-break, followed by a word beginning with a capital letter. If you input this as a Find/Replace expression(Ctrl-H), with the 'Use wildcards' option checked, using the same expression via Ctrl-F in the Navigation pane should highlight all the candidates.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
first word, lady ana, macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Question: Need help making a macro to highlight the first word in every sentence Macro to highlight a list of words bakerkr Word VBA 4 10-19-2017 02:23 PM
Macro Question: Need help making a macro to highlight the first word in every sentence Question about macro in word 2013 tombags Word 1 06-25-2014 04:56 PM
Macro Question: Need help making a macro to highlight the first word in every sentence Macro to highlight words bertietheblue Word VBA 9 07-01-2013 12:39 PM
Macro Question: Need help making a macro to highlight the first word in every sentence Macro to highlight text between 2 points in word 2010 jsilva1950 Word VBA 2 04-25-2013 12:21 AM
Trying to highlight pasted text in a macro goldengate Word VBA 0 09-14-2010 09:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:05 AM.


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