![]() |
|
![]() |
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
![]()
Try this:
Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim strAbbr, i As Long Dim oRng As Range strAbbr = ".Mr.Mrs.Ms.etc." With Selection Set oRng = Selection.Range On Error GoTo Err_End Do While .Characters.Last.Next = vbCr .MoveEnd wdCharacter, 1 Loop Set oRng = Selection.Range .Collapse 0 If .End <= .Sentences.First.End Then .MoveEnd wdSentence, 1 Do While InStr(strAbbr, "." & Trim(.Words.Last.Previous.Words.First) & ".") > 0 _ Or Selection.Text = vbCr _ Or Right(.Text, 3) = "., " .MoveEnd wdSentence, 1 Loop oRng.End = .End End With Do While oRng.Characters.Last = vbCr Or oRng.Characters.Last = Chr(11) oRng.MoveEnd wdCharacter, -1 Loop oRng.Select lbl_Exit: Exit Sub Err_End: Resume lbl_Exit End Sub |
![]() |
|
![]() |
||||
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 |