Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
checking Font Color in a macro
If I have a macro in word where I change the font color [using shortcut keys
I made -- Alt-R and Alt-B -- from the: Tools Customize Menu; Then selecting Commands then Keyboard . And from there just selecting Format in the Categories, and FontColor in the Commands. Anyway -- I'm not familiar enough with the objects to know how to do this offhand, but I'm wondering if there's a way to check what the fontcolor is in the macro, and if it's black I'll switch it to red, and if it's red I'll switch it to black. I was just hoping this could be done in a relatively simple IF statement, and if there are any examples out there I can check out if anyone can guide me in that direction, that'd be great. Any thoughts anyone could spare would be appreciated. Thanks again, M |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
checking Font Color in a macro
What the font color is where? Do you mean the selected text? Then
perhaps something like: Sub Scratchmacro() Dim oRng As Word.Range Set oRng = Selection.Range Select Case oRng.Font.Color Case wdColorRed oRng.Font.Color = wdColorAutomatic Case wdColorAutomatic oRng.Font.Color = wdColorRed Case Else 'Do nothing or do whatever End Select End Sub MatthewS wrote: If I have a macro in word where I change the font color [using shortcut keys I made -- Alt-R and Alt-B -- from the: Tools Customize Menu; Then selecting Commands then Keyboard . And from there just selecting Format in the Categories, and FontColor in the Commands. Anyway -- I'm not familiar enough with the objects to know how to do this offhand, but I'm wondering if there's a way to check what the fontcolor is in the macro, and if it's black I'll switch it to red, and if it's red I'll switch it to black. I was just hoping this could be done in a relatively simple IF statement, and if there are any examples out there I can check out if anyone can guide me in that direction, that'd be great. Any thoughts anyone could spare would be appreciated. Thanks again, M |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
checking Font Color in a macro
Sorry -- yes, I meant the selected text, and that's what I was looking for
[the case statement makes more sense]. thanks. "Greg Maxey" wrote: What the font color is where? Do you mean the selected text? Then perhaps something like: Sub Scratchmacro() Dim oRng As Word.Range Set oRng = Selection.Range Select Case oRng.Font.Color Case wdColorRed oRng.Font.Color = wdColorAutomatic Case wdColorAutomatic oRng.Font.Color = wdColorRed Case Else 'Do nothing or do whatever End Select End Sub MatthewS wrote: If I have a macro in word where I change the font color [using shortcut keys I made -- Alt-R and Alt-B -- from the: Tools Customize Menu; Then selecting Commands then Keyboard . And from there just selecting Format in the Categories, and FontColor in the Commands. Anyway -- I'm not familiar enough with the objects to know how to do this offhand, but I'm wondering if there's a way to check what the fontcolor is in the macro, and if it's black I'll switch it to red, and if it's red I'll switch it to black. I was just hoping this could be done in a relatively simple IF statement, and if there are any examples out there I can check out if anyone can guide me in that direction, that'd be great. Any thoughts anyone could spare would be appreciated. Thanks again, M |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro not working on other pc's | New Users | |||
macro button | Microsoft Word Help | |||
Deleting Old Versions of Fonts | Microsoft Word Help | |||
font color in macro | Microsoft Word Help | |||
font color in macro | Microsoft Word Help |