![]() |
#2
|
||||
|
||||
![]()
Try the following, which works even if you don't have whole words selected and preserves the original formatting:
Code:
Sub DuplicateSelectedWords() Dim Rng As Range With Selection If .Type = wdSelectionIP Then MsgBox "Select the text first", vbCritical Exit Sub End If Set Rng = ActiveDocument.Range(.Words.First.Start, .Words.Last.End) End With With Rng.Duplicate .Collapse wdCollapseEnd .FormattedText = Rng.FormattedText End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
ranjan | Word VBA | 7 | 08-26-2021 02:17 AM |
Page numbers not following. All sections continuous, link to previous selected. | ClaireP | Word | 4 | 07-07-2020 08:12 AM |
![]() |
Bookmaster | Word VBA | 7 | 02-03-2015 04:30 PM |
![]() |
cinvest | Word | 1 | 09-29-2014 08:34 PM |
Why Words doesn’t show the style of the selected words automatically???? | Jamal NUMAN | Word | 0 | 04-14-2011 03:20 PM |