Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-13-2014, 08:13 PM
alantnz alantnz is offline font color change problem Windows 7 32bit font color change problem Office 2013
Novice
font color change problem
 
Join Date: Sep 2014
Posts: 1
alantnz is on a distinguished road
Default font color change problem

I use the following macro



Code:
Sub DIAMOND()
'
' DIAMOND Macro
'
'
With Selection.Range
  .InsertBefore ChrW(&H2666)
  .Font.ColorIndex = wdRed
End With
Selection.Move Unit:=wdCharacter, Count:=1
With Selection
  .Font.ColorIndex = wdAuto
End With
End Sub
It prints a red diamond symbol but reverts to a black font for the next character. However when I try to embed this in a longer macro (part of which follows) the next character does not revert to black
Code:
Sub fourhand()
'
' fourhand Macro
'
'
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=3, NumColumns:= _
3, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
  If .Style <> "Table Grid" Then
    .Style = "Table Grid"
  End If
  .ApplyStyleHeadingRows = True
  .ApplyStyleLastRow = False
  .ApplyStyleFirstColumn = True
  .ApplyStyleLastColumn = False
  .ApplyStyleRowBands = True
  .ApplyStyleColumnBands = False
End With
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.InsertSymbol Font:="Arial", CharacterNumber:=9824, Unicode:=True
Selection.TypeParagraph
With Selection.Range
  .InsertBefore ChrW(&H2665)
  .Font.ColorIndex = wdRed
End With
Selection.Move Unit:=wdCharacter, Count:=1
With Selection
  .Font.ColorIndex = wdAuto
End With
End Sub
Can anyone help please?

Last edited by macropod; 09-15-2014 at 04:07 PM. Reason: Added code tags & formatting
Reply With Quote
  #2  
Old 09-15-2014, 04:06 PM
macropod's Avatar
macropod macropod is offline font color change problem Windows 7 64bit font color change problem Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your code works for me.

PS: When posting code, please use the code tags. They're on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


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
Make a certain font face and font color as default in a document. Singh_Edm Word VBA 2 09-13-2014 08:47 PM
How to change the font color of cell values sky474 Excel 7 03-06-2014 09:15 AM
how to search and replace BOLD text >> font color change? dylansmith Word 4 03-12-2013 09:51 PM
font color change problem change default font color to wdRed tinfanide Word VBA 6 06-07-2012 06:48 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:16 AM.


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