Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 07-06-2022, 04:58 AM
Guessed's Avatar
Guessed Guessed is offline Need help with word macro to duplicate paragraphs in word document Windows 10 Need help with word macro to duplicate paragraphs in word document Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

OK, this version doesn't have that issue but won't retain other formatting into the duplicate.
Code:
Sub TranslationPrep()
  Dim iPar As Double, aRng As Range, aPar As Paragraph
  Dim iCount As Double, aRngAdd As Range, iExtra As Integer
  Dim sPar As String
  With ActiveDocument
    For iPar = .Paragraphs.Count To 1 Step -1
      Set aPar = .Paragraphs(iPar)
      Set aRng = aPar.Range
      If Len(Trim(aRng.Text)) > 2 Then
        Set aRngAdd = .Range(aRng.Start, aRng.Start)
        sPar = Trim(Split(aRng.Text, vbCr)(0))
        aRngAdd.Text = sPar & vbCr
        aRngAdd.Font.Hidden = True
        With aRng.Paragraphs.Last.Range
          .Font.ColorIndex = wdBlue
          .ListFormat.RemoveNumbers NumberType:=wdNumberParagraph
        End With
      End If
    Next iPar
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Word VBA macro] How to open the website [languagetool.org] and check my Word document? citroen Word VBA 0 10-25-2020 05:07 AM
ms word document text translation using vba code pk_00 Word VBA 1 03-02-2020 03:11 PM
Macro to extract bookmarked data from Word document and insert into another Word Document VStebler Word VBA 3 05-03-2018 05:02 PM
Macro to transfer data from Word to another Word document with bookmark Jovan Yong Word VBA 3 04-17-2018 04:27 AM
Need help with word macro to duplicate paragraphs in word document Word Macro to publish document as pdf (Word 2010) bville Word VBA 2 04-11-2013 03:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft