Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-04-2023, 10:15 PM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Need help with a script with Selection and If for Font Size < 8? Windows 10 Need help with a script with Selection and If for Font Size < 8? Office 2019
Competent Performer
Need help with a script with Selection and If for Font Size < 8?
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Default

Fixed the scripts

Test this out.
Copy the below, and put the font size as the number prior to text.
Then copy the script and ask to change any font size of ''8 and below'', then run the script, It should color and highlight, everything except for the size 8.5 (since you will ask to find size 8 and below).

7
Sub FNR_SI_Format_Police_sous_Grosseur_7_met_grosseur_ 8p5_avec_variable()
'Works 2023-06-05
'CommentMania, original script name
'found here in forum :https://www.msofficeforums.com/word-...mes-sizes.html
'done by Guessed / Andrew Lockton 2018-06-13 at 9:00 am // modified by me 2023-06-05


7.5
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


6.5
sVar1 = InputBox("Entre la grosseur de la police recherché si en bas de la grosseur désirée." _
& vbCr & "Pour des demi-points, met une virgule. Exemple : 7,5", "SUGGESTION", "7,5") 'pour les anglais, c'est point vs virgule 7.5 ENG / 7,5 FRE

sVar2 = InputBox("Entre la grosseur de la police à remplacé si trouvé en bas de...." _
& vbCr & "Pour des demi-points, met une virgule. Exemple : 9 ou 8,5", "SUGGESTION", "8,5") 'pour les anglais, c'est point vs virgule 8.5 ENG / 8,5 FRE




8.5
For Each aPara In aRng.Paragraphs

If aPara.Range.Font.Size <= sVar1 Then

Options.DefaultHighlightColorIndex = wdYellow


8
aPara.Range.Font.Size = sVar2
aPara.Range.HighlightColorIndex = wdYellow
aPara.Range.Font.ColorIndex = wdTeal
End If

Next aPara

End Sub

Let me know how it turns out for others

C
Reply With Quote
Reply

Tags
code, font macro, help please



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with a script with Selection and If for Font Size &lt; 8? VBA - Word how to globally change the font and font size in footnotes thomasoj Word VBA 3 01-15-2020 06:26 AM
Need help with a script with Selection and If for Font Size &lt; 8? Merging two Word documents: 2nd document not maintaining original font type and font size Swarup Word 31 08-28-2018 06:55 PM
Word 10: need information typed to be in font of default selection instead of Template Font 1SickPuppy Word 1 05-06-2017 03:00 PM
Font size showing different (some superscripted??) but tools show its the same size? mikkygee PowerPoint 4 12-14-2015 11:21 PM
Need help with a script with Selection and If for Font Size &lt; 8? Looping Macro to Change Font, Font Size, and Give Heading 1 WH7262 Word VBA 1 08-26-2014 03:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft