![]() |
|
#2
|
|||
|
|||
|
So after messing about, and finding bits of code online, i've managed to come up with this...
I hope it helps others looking to do the same thing. ![]() ---------------------------------------------------------------------------------------- Sub wordslistChange() Dim avar As Variant avar = Split(Replace(ActiveDocument.Range.Text, vbCr, " ")) For i = LBound(avar) To UBound(avar) i = i + 1 'MsgBox avar(i) With Selection.Find .ClearFormatting .Text = avar(i) On Error Resume Next .MatchCase = True .MatchWholeWord = True .Replacement.ClearFormatting .Replacement.Text = avar(i) .Replacement.Font.Color = wdColorRed 'change colour as required .Forward = True .Wrap = Word.WdFindWrap.wdFindContinue .Execute Replace:=Word.WdReplace.wdReplaceOne End With Next i End Sub ------------------------------------------------------------------------------------------ This basically populates the array and then does the odd even colour change magic. Have fun people and feel free to mod the code to make it even more efficient. Thank you
Last edited by Harvi007; 08-05-2022 at 10:32 PM. |
| Tags |
| macro font colour, vba change colour |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Word Macro Recorder does not record font colour selection | Ramkay | Word | 1 | 12-02-2020 07:48 AM |
VBA - Word how to globally change the font and font size in footnotes
|
thomasoj | Word VBA | 3 | 01-15-2020 06:26 AM |
VBA to change font colour in email body on send
|
RealmOfCOnfusion | Outlook | 1 | 06-30-2016 09:55 PM |
Change font colour when tasks are completed
|
meileetan | Project | 3 | 09-12-2012 07:09 AM |
Change Colour Theme in Word with VBA
|
Davidoff78 | Word VBA | 1 | 06-28-2012 05:23 PM |