View Single Post
 
Old 06-04-2023, 09:07 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Default

Here is with variants (Find & Replace) and color Teal the font change, here is the scripts :

Code:
Sub FNR_Font_Mod_ONLY_size_Variant_from_xx_to_xx_with_Colr()
'Works 2023-06-05
'CommentMania, original script name
'found here in forum :https://www.msofficeforums.com/word-vba/38890-macro-font-names-sizes.html
'done by Guessed / Andrew Lockton 2018-06-13 at 9:00 am  // modified by me 2023-06-05

  Dim aRng As Range, aPara As Paragraph
  Dim sVar1 As Variant                'Font Size IF below
  Dim sVar2 As Variant                'Font Size TO change if found
  
  Set aRng = ActiveDocument.Range

    sVar1 = InputBox("Enter the size of the Font to Search for IF below a certain size." _
     & vbCr & "This includes half points. Example : 7.5", "SUGGESTION", "7.5")                                      'For ENG, it's a period vs comma for FRE 7.5 ENG / 7,5 FRE

    sVar2 = InputBox("Enter the desired Font Size, replacing the prior variable, if below...." _
     & vbCr & "This includes half points. Example : 9 ou 8.5", "SUGGESTION", "8.5")                                 'For ENG, it's a period vs comma for FRE 7.5 ENG / 7,5 FRE

  For Each aPara In aRng.Paragraphs
  
     'If aPara.Range.Font.Size < 7 Then
      If aPara.Range.Font.Size <= sVar1 Then
          
'          aPara.Range.Font.Name <> "Arial"
          aPara.Range.Font.Size = sVar2
          aPara.Range.Font.ColorIndex = wdTeal
      End If

  Next aPara

End Sub
Works, again, I didn't search yet for the HighLight, but I'll try it now.

Let me know if it works on your side too

C

Last edited by Cendrinne; 06-04-2023 at 11:09 PM. Reason: Modified to show Search for below or equal font size
Reply With Quote