View Single Post
 
Old 12-06-2023, 01:07 AM
RobiNew RobiNew is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Sep 2023
Posts: 208
RobiNew is on a distinguished road
Default Check uniform font size in each paragraph

This simple macro checks the font size in each paragraph of the doc. But this is not what I want. I need to check if some paragraph contains a string with a different font size from the rest of the paragraph. Can someone help? Thanks!
Example: Macros are not always easy to devise.
Code:
Sub FontSize()
  Dim aRng As Range, aPara As Paragraph
  Set aRng = ActiveDocument.Range
  aRng.End = ActiveDocument.Range.End
  For Each aPara In aRng.Paragraphs
        If aPara.Range.Font.Size <> 12 Then
        aPara.Range.Select
        MsgBox "Check font size"
      End If
      aRng.Collapse wdCollapseEnd
  Next aPara
End Sub
Reply With Quote