Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
MatthewS MatthewS is offline
external usenet poster
 
Posts: 16
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 171
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
MatthewS MatthewS is offline
external usenet poster
 
Posts: 16
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro not working on other pc's akkrug New Users 15 August 22nd 06 01:07 PM
macro button Jack B Microsoft Word Help 5 July 26th 06 04:22 PM
Deleting Old Versions of Fonts Lana A Li Microsoft Word Help 5 September 1st 05 09:51 PM
font color in macro Glenn Microsoft Word Help 1 January 31st 05 05:32 AM
font color in macro gstraube Microsoft Word Help 0 January 30th 05 04:43 PM


All times are GMT +1. The time now is 07:46 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"