Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-04-2023, 01:13 AM
RobiNew RobiNew is offline Find and format lines of verse Windows 10 Find and format lines of verse Office 2016
Competent Performer
Find and format lines of verse
 
Join Date: Sep 2023
Posts: 183
RobiNew is on a distinguished road
Default Find and format lines of verse

I have a tentative code to find consecutive one-line paragraphs (lines of verse) and to replace Chr(13) with (11) at the end of the line. I have uploaded a test docx. Can someone help? Thanks!
Code:
Sub LinesOfVerse()
    For Each Paragraph In ActiveDocument.Paragraphs
TypePara = "No"
NrPara = NrPara + 1
If Paragraph.Range.ComputeStatistics(wdStatisticLines) = 1 Then
    Paragraph.Range.Select
    Paragraph.Range.Characters.Last.Text = vbNullString
    Paragraph.Range.Characters.Last.Text = Chr(11)
    Paragraph.Range.Characters.Last.Text = vbNullString
    Paragraph.Range.Characters.Last.Text = Chr(11)
    TypePara = "Yes"
End If
If Paragraph.Range.ComputeStatistics(wdStatisticLines) = 1 _
And TypePara = "Yes" Then
    Paragraph.Range.Select
    Paragraph.Range.Characters.Last.Text = vbNullString
    Paragraph.Range.Characters.Last.Text = Chr(11)
    Paragraph.Range.Characters.Last.Text = vbNullString
    Paragraph.Range.Characters.Last.Text = Chr(11)
'    MsgBox "Check!"
End If
    Next
     End Sub

Attached Files
File Type: docx Lines of verse.docx (45.1 KB, 5 views)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Format Word Document - Remove timestamps on individual lines lbeck Word 4 06-21-2023 12:47 PM
How do I format indented bulleted lines??? HELP PLEASE!!! nicholeproffitt Word 1 02-05-2015 05:42 PM
Find and format lines of verse Print table and on verse form vba LaercioNB Excel 1 08-09-2013 06:03 PM
How to remove unwanted lines - I cannot even find how/where they are inserted! nickib Word 7 08-09-2013 06:01 AM
Find and format lines of verse Find and Replace multiple lines/paragraphs jcw Word 1 11-18-2011 11:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:33 AM.


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