![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#9
|
||||
|
||||
|
Try this version of the macro - it doesn't require the secondary macros.
Code:
Sub MoveBlockToBeginningOfSentence()
Dim aRngMove As Range, aRngStart As Range
Set aRngMove = Selection.Range
If aRngMove.Characters.Last <> " " Then 'ensure the selection includes a space at the end
aRngMove.MoveEndUntil cset:=" "
aRngMove.MoveEnd Unit:=wdCharacter, Count:=1
End If
Set aRngStart = aRngMove.Sentences(1)
aRngStart.Characters(1).Case = wdLowerCase
aRngStart.Collapse Direction:=wdCollapseStart
aRngMove.Characters(1).Case = wdTitleWord
aRngStart.FormattedText = aRngMove.FormattedText
aRngMove.Delete
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Keep text selected after paste
|
dabbler | Word | 14 | 01-11-2021 09:54 AM |
Copy selected text from one document and paste to new document in same position on the page
|
gasparik | Word VBA | 1 | 05-11-2020 05:41 AM |
Find and Replace Selected Text or Macro for finding selected text
|
mrplastic | Word VBA | 4 | 12-20-2019 01:25 PM |
Help debugging a Macro that merges individual word docs into one document
|
vincenzo345 | Word VBA | 4 | 12-01-2017 11:25 AM |
Macro (debugging)
|
JACKsparrow | Word VBA | 1 | 03-09-2016 02:47 PM |