View Single Post
 
Old 11-09-2023, 07:38 AM
RobiNew RobiNew is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Sep 2023
Posts: 200
RobiNew is on a distinguished road
Default

Hi, Gmaxey! I tried this code of yours on its own and it produces an error: Object variable or With block variable not set. Please help. Thanks!

Code:
Sub Unnumbered()
Dim oPar As Paragraph
Dim oRng As Range
  For Each oPar In oRng.Paragraphs
    If oPar.Range.ComputeStatistics(wdStatisticLines) = 1 _
         And oPar.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft _
         And Not oPar.Range Like "*[0-9]*" Then
      oPar.Range.Style = "Mystyle"
    End If
  Next oPar
End Sub

UPDATE: I managed to amend with:
For Each oPar In ActiveDocument.Paragraphs
Reply With Quote