![]() |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
I am very new to VBA coding but am realizing how powerful it is. To this point I have been using Autohotkey to automate Word, but it cannot handle one task I have in mind:
I want a macro that moves the insertion point to the beginning of the next sentence. Obviously the one built in to Word already is as follows: Code:
Selection.MoveRight Unit:=wdSentence, Count:=1 So the only thing I want to change about Word’s definition of a sentence is to exclude certain words from its definition that I know are not the end of a sentence, like "Mr. " and the examples I give above. But writing this macro is proving elusive to me despite hours of trying to figure it out. If any coding geniuses could whip up the perfect macro, that would be amazing. If not, could you help me with bits of it? From my research, I am thinking I will have to define a Range that extends from the current insertion point position to the end of the next period plus space or the next new-paragraph sign, but not including instances such as “Dr. ” or “Mr. ” or “Mrs. ” Then I will move the insertion point from its current position to the end of that Range. Also, from my understanding the only way to move the insertion point based on surrounding text is by using the "With Selection.Find" function, as described here. Is that true? This has a good example of how to exclude certain characters from a search using the Find function, but again, I am at a loss to write this complex code with my current knowledge. Thank you so much to anyone willing to help! |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Select backstage Print command programmatically | NobodysPerfect | Excel Programming | 0 | 04-23-2015 08:52 AM |
Select the whole sentence when a word has been modified | gloos | Word VBA | 1 | 04-14-2015 10:24 PM |
![]() |
ndnd | Word VBA | 10 | 01-06-2015 01:47 PM |
![]() |
Microsoftenquirer1000 | Word | 8 | 11-19-2014 02:10 PM |
Microsoft Word 2003: casual style from the writing box? | intooutfrom | Word | 0 | 01-04-2010 01:52 PM |