Format MACROBUTTON field text?

E

Ed

I am adding a MACROBUTTON field using
ActiveDocument.Fields.Add Range:=rng, _
Type:=wdFieldEmpty, Text:= _
"MACROBUTTON LeftOffHere ""Doubleclick HERE to go to last edit"" ",
_
PreserveFormatting:=False

Can I format the visible text (Doubleclick HERE to go to last edit)? I
would like to highlight the text red, or at least turn the font color red.
So far, though, I've been unable to accomplish this using
Range.Font.HighlightColorIndex or Range.Font.ColorIndex. Am I trying to do
what isn't possible?

Ed
 
J

Jean-Guy Marcil

Ed was telling us:
Ed nous racontait que :
I am adding a MACROBUTTON field using
ActiveDocument.Fields.Add Range:=rng, _
Type:=wdFieldEmpty, Text:= _
"MACROBUTTON LeftOffHere ""Doubleclick HERE to go to last
edit"" ", _
PreserveFormatting:=False

Can I format the visible text (Doubleclick HERE to go to last edit)? I
would like to highlight the text red, or at least turn the font
color red. So far, though, I've been unable to accomplish this using
Range.Font.HighlightColorIndex or Range.Font.ColorIndex. Am I trying
to do what isn't possible?

Try something like this:

Dim rng As Range
Dim rngField As Range

Set rng = ActiveDocument.Paragraphs(1).Range
rng.Collapse wdCollapseStart

ActiveDocument.Fields.Add Range:=rng, _
Type:=wdFieldEmpty, Text:= _
"MACROBUTTON LeftOffHere ""Doubleclick HERE to go to last edit"" ", _
PreserveFormatting:=False

Set rngField = rng.Paragraphs(1).Range.Fields(1).Code
With rngField
.Font.Color = wdColorRed
End With

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
E

Ed

Beautiful!! Thank you!
Ed

Jean-Guy Marcil said:
Ed was telling us:
Ed nous racontait que :


Try something like this:

Dim rng As Range
Dim rngField As Range

Set rng = ActiveDocument.Paragraphs(1).Range
rng.Collapse wdCollapseStart

ActiveDocument.Fields.Add Range:=rng, _
Type:=wdFieldEmpty, Text:= _
"MACROBUTTON LeftOffHere ""Doubleclick HERE to go to last edit"" ", _
PreserveFormatting:=False

Set rngField = rng.Paragraphs(1).Range.Fields(1).Code
With rngField
.Font.Color = wdColorRed
End With

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top