#1
|
||||
|
||||
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. |
#2
|
||||
|
||||
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] |
#3
|
||||
|
||||
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.
|
#4
|
|||
|
|||
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.
|
#5
|
||||
|
||||
Okay, thanks for letting me know. I may have been clicking icons on the ribbon, that would explain the problem.
|
#6
|
|||
|
|||
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.
|
#7
|
||||
|
||||
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] |
#8
|
|||
|
|||
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 |
#9
|
||||
|
||||
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] |
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 |
Change Follwed Hyperlink color in Word 2010 | Henry | Word | 1 | 07-05-2011 04:29 PM |
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 |
Need help copy and pasting from internet to word, font change sizes. | pearce88 | Word | 3 | 11-19-2009 11:27 PM |