View Single Post
 
Old 12-04-2023, 09:37 AM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

You don't need a range object for that solution. You need a paragraph object.


30 what? centimeters, inches, yards, meters or points?
Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oPar As Paragraph
  For Each oPar In ActiveDocument.Paragraphs
    If oPar.Range.ParagraphFormat.Alignment = wdAlignParagraphRight _
      Or oPar.Range.ParagraphFormat.LeftIndent > 30 Then
      oPar.Range.Font.Italic = False
    End If
  Next oPar
lbl_Exit:
  Set oPar = Nothing
  Exit Sub
End Sub
Why do you declare some variables and not others? Do you have the Option Explicit statement at the top of your project module?
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote