View Single Post
 
Old 04-01-2013, 06:31 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

IIRC, the ' + Left: 0.89' doesn't denote part of the Style name, but a format that has been used to override it. Accordingly, you would have to Find paragraphs in the style named Style Body, then test their format to see whether they have the + Left: 0.89 formatting applied. The macro recorder won't do that. Try the following code:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Sty As Style, sOffset As Single
sOffset = CentimetersToPoints(0.89)
With ActiveDocument
  Set Sty = .Styles("Body Text")
  With .Range
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "^p"
      .Style = Sty.NameLocal
      .Replacement.Text = ""
      .Forward = True
      .Wrap = wdFindStop
      .Format = True
      .MatchCase = False
      .MatchWholeWord = False
      .MatchWildcards = False
      .MatchSoundsLike = False
      .MatchAllWordForms = False
      .Execute
    End With
    Do While .Find.Found
      With .Paragraphs(1)
        If CentimetersToPoints(Round(PointsToCentimeters(.LeftIndent), 2)) = _
          Sty.ParagraphFormat.LeftIndent + sOffset Then .Style = "List 3"
      End With
      .Collapse wdCollapseEnd
      .Find.Execute
    Loop
  End With
End With
Application.ScreenUpdating = True
End Sub
Note: the code assumes your 0.89 is Centimeters. If it's Inches, change 'Centimeters' in the code to 'Inches'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote