View Single Post
 
Old Today, 03:40 AM
RobiNew RobiNew is offline Windows 11 Office 2016
Competent Performer
 
Join Date: Sep 2023
Posts: 229
RobiNew is on a distinguished road
Default

Hi Macropod! Could you please correct the following macro? Thanks!
Code:
Sub FormatAndDelete()
'Format left titles
For Each oPar In ActiveDocument.Paragraphs
'Deletes period at end of paragraph (Fails!!)
    With oPar.Range.Characters
    If oPar.Range.Characters.Last.Previous = "." Then oPar.Range.Characters.Last.Previous = vbNullString
    End With
    If oPar.Range.ComputeStatistics(wdStatisticLines) = 1 _
         And oPar.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft _
         And Not oPar.Range Like "*[0-9]*" Then
      oPar.Range.Style = "LeftTitle"
    End If
Next oPar
End Sub

Last edited by macropod; Today at 05:07 AM. Reason: Corrected code tags
Reply With Quote