![]() |
#1
|
|||
|
|||
![]()
Hello,
I need to create a macro to duplicate each of the paragraphs in a file (including the content within tables), maintaining the same formatting, and then hide the first paragraph in each instance (including the content within tables). I checked this forum and I found a macro: it duplicates, keeps formatting and hide the content; however it stops working after the first paragraph. I don't know why. This is the macro: Sub Macro1() Dim oRng As Range Dim oPara As Range, oNewPara As Range Dim i As Long Set oRng = Selection.Range If oRng.End = ActiveDocument.Range.End Then oRng.InsertParagraphAfter End If For i = oRng.Paragraphs.Count To 1 Step -1 Set oPara = oRng.Paragraphs(i).Range Set oNewPara = oPara.Duplicate oNewPara.Collapse 0 oNewPara.FormattedText = oPara.FormattedText Next i lbl_Exit: Set oRng = Nothing Set oPara = Nothing Set oNewPara = Nothing Exit Sub End Sub Thanks! |
Tags |
duplicate sentences, hide, paragraph formatting |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
TucsonJack | Word | 7 | 04-26-2023 04:36 PM |
![]() |
Salah | Word VBA | 1 | 03-02-2017 03:02 AM |
OneNote Clipper Addon stops working | dannyetlv | OneNote | 0 | 08-05-2016 09:12 AM |
Autotransition stops while working on extended desktop | IT1 | PowerPoint | 1 | 11-04-2015 11:19 PM |
Outlook Stops Working | TOKonline | Outlook | 0 | 09-26-2014 05:39 AM |