Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-18-2011, 02:19 PM
Spideriffic's Avatar
Spideriffic Spideriffic is offline Word macro doesn't change font color Windows 7 32bit Word macro doesn't change font color Office 2010 32bit
Novice
Word macro doesn't change font color
 
Join Date: Dec 2011
Location: Plainview, NY
Posts: 4
Spideriffic is on a distinguished road
Question Word macro doesn't change font color


I recorded a macro in Word 2010. I started recording, then I used the keyboard (no mouse clicks) to select a line of text, change the color from black to green, then move the cursor down to the next line. When I run the macro, the cursor moves down one line, but there is no color change. That shows me that the macro is running, but why isn't the color change working? Thank you.
Reply With Quote
  #2  
Old 12-18-2011, 02:34 PM
macropod's Avatar
macropod macropod is offline Word macro doesn't change font color Windows 7 64bit Word macro doesn't change font color 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

Hi Spiderrific,

Without seeing the macro code, it's hard to say. However, here's a macro to do what you've described:
Code:
Sub Green()
With Selection
  .EndKey Unit:=wdLine, Extend:=wdExtend
  .Font.ColorIndex = wdGreen
  .MoveDown Unit:=wdLine, Count:=1
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-18-2011, 03:15 PM
Spideriffic's Avatar
Spideriffic Spideriffic is offline Word macro doesn't change font color Windows 7 32bit Word macro doesn't change font color Office 2010 32bit
Novice
Word macro doesn't change font color
 
Join Date: Dec 2011
Location: Plainview, NY
Posts: 4
Spideriffic is on a distinguished road
Default Re: Why doesn't my macro work correctly in Word 2010?

I looked at the macro code that I had, and it looked pretty similar to what you posted, except the line referring to font color just wasn't there. I popped that in there and now the macro works as I desired. Just wondering why that step wasn't recorded in automatically. I tried recording it several times, always with the same result. Anyway, now I have what I wanted, thank you.
Reply With Quote
  #4  
Old 03-06-2012, 01:37 PM
Ktoki Ktoki is offline Word macro doesn't change font color Windows 7 32bit Word macro doesn't change font color Office 2010 32bit
Novice
 
Join Date: Mar 2012
Posts: 1
Ktoki is on a distinguished road
Default Re: Font Color, etc.

Macros won't record mouse movement or Icons on the Ribbon. You have to use the Font Dialogue Box to make your changes instead.
Reply With Quote
  #5  
Old 03-06-2012, 11:14 PM
Spideriffic's Avatar
Spideriffic Spideriffic is offline Word macro doesn't change font color Windows 7 32bit Word macro doesn't change font color Office 2010 32bit
Novice
Word macro doesn't change font color
 
Join Date: Dec 2011
Location: Plainview, NY
Posts: 4
Spideriffic is on a distinguished road
Default

Okay, thanks for letting me know. I may have been clicking icons on the ribbon, that would explain the problem.
Reply With Quote
  #6  
Old 09-27-2014, 05:09 AM
Pepe Pepe is offline Word macro doesn't change font color Windows 7 64bit Word macro doesn't change font color Office 2010 32bit
Novice
 
Join Date: Sep 2014
Posts: 1
Pepe is on a distinguished road
Default Font colour and Macros

I had exactly the same problem. However, this did work in Office 2007. This looks like a MicroSoft bug as other options on the ribbon work. However, the font colour does not record unless you open the font window as indicated on this thread.
Reply With Quote
  #7  
Old 09-27-2014, 06:07 AM
macropod's Avatar
macropod macropod is offline Word macro doesn't change font color Windows 7 64bit Word macro doesn't change font color 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

This is not a bug. The macro recorder has never recorded everything a user might do through the GUI and there are many other ribbon actions it most certainly will not record.

PS: Please don't resurrect old threads just to add comments. This one was solved nearly three years ago.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 11-04-2015, 03:16 AM
MJA MJA is offline Word macro doesn't change font color Windows 10 Word macro doesn't change font color Office 2013
Banned
 
Join Date: Sep 2015
Posts: 3
MJA is on a distinguished road
Default My Font Color WOn't Change Either -- But Strangely

All right, how about this variant on the same problem: I select a sentence, and use a recorded macro to change it to black. (The original sentence was gray.) All the words in the sentence obediently change to black -- except one. That word will not change unless I a) click on the ribbon to change it, or b) erase all styles from the word and only then run my macro on it.

This is not the only document this has happened in. And sometimes longer stretches refuse to change color. I have examined the text using the style inspector and the more detailed information available on the style pane. It appears absolutely identical to the text on either side of it.

The only common factor I can think of is that I have always been dictating this text with Dragon NaturallySpeaking. Might that have some impact? It's difficult to see how when the style inspector says it is identical to the text that will turn black obligingly.

Any ideas on how to tweak the macro? (Other than erasing all styles, since reinstating the styles in the macro would require that I know in advance what font styles will be used in every document.)

Thanks.

EDIT: I've just noticed that the problem concerns only text that is grey (it's actually 'Black: 50% Lighter on the ribbon text color selector). There is also dark red text, changed using a different macro, and that changes back to black just fine in every case. Which makes this seem like it's going to be a Microsoft bug, and not due to something in Dragon NaturallySpeaking.

Last edited by MJA; 11-04-2015 at 03:46 AM. Reason: Add information
Reply With Quote
  #9  
Old 11-04-2015, 03:47 AM
macropod's Avatar
macropod macropod is offline Word macro doesn't change font color Windows 7 64bit Word macro doesn't change font color 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

No-one could possibly answer questions about your macro or the content it fails to change without seeing both. Aside from which, these kinds of changes should be done via the application of the appropriate Styles, not by overriding the existing one (which may be behind your problem).

If you attach a document to a post with some representative data (delete anything sensitive) and your code, someone could take a look at it for you. You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
macro font color

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2010- help setting automatic font color Jazz43 Word 7 09-27-2012 10:59 PM
Word macro doesn't change font color Change Follwed Hyperlink color in Word 2010 Henry Word 1 07-05-2011 04:29 PM
Word macro doesn't change font color Word 2007 Font Color Doesn't Work nnicko Word 2 04-16-2010 01:21 PM
Change Default Font Word datuk.ahmad Word 3 03-09-2010 04:47 PM
Word macro doesn't change font color Need help copy and pasting from internet to word, font change sizes. pearce88 Word 3 11-19-2009 11:27 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:23 PM.


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