#1
|
|||
|
|||
Apply font color programatically using VBA Word
Hi,
I have code written below, as the code applying color Red to Tick Mark, but the issue is the color Red applying to entire Text entered in Word. I want the code to be applied to only Tick Mark not the entire text. Ex: “Th℞is is my test “ in this text ℞ is the Tick Mark and “This” is the text entered in word changed to Red. Code:
If TextPress Then ActiveDocument.Characters.Parent 'Get current font name and color FName = selection.Font.Name fColor = selection.Font.Color FStrikeThrough = selection.Font.StrikeThrough FItalic = selection.Font.Italic 'Insert mark selection.Font.Name = FontName selection.Font.Color = ColorLevel selection.Font.StrikeThrough = IsStrikethrough selection.Font.Italic = IsItalic selection.Font.Name = FontName selection.TypeText Text:=TM_Chr If FirstTMText = False Then For i = 1 To Len(TM_Chr) selection.Previous(Unit:=wdCharacter, Count:=1).Select selection.Delete Next i selection.Font.Name = FontName selection.Font.Color = ColorLevel selection.Font.StrikeThrough = IsStrikethrough selection.Font.Italic = IsItalic selection.Font.Name = FontName selection.TypeText Text:=TM_Chr FirstTMText = True End If Last edited by macropod; 08-08-2012 at 05:01 PM. Reason: Added code tags & formatting |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word macro doesn't change font color | Spideriffic | Word VBA | 8 | 11-04-2015 03:47 AM |
Word 2010- help setting automatic font color | Jazz43 | Word | 7 | 09-27-2012 10:59 PM |
Font Color not working in PowerPoint | MrsMoe | PowerPoint | 2 | 12-27-2010 03:42 AM |
Word 2007 Font Color Doesn't Work | nnicko | Word | 2 | 04-16-2010 01:21 PM |
need help with font color | samsongee | Word | 0 | 09-07-2006 10:18 PM |