I need to remove shading of a FORMTEXT Field on The Exit Macro...

Hi,

My FormText Fields on my document are shaded GRAY (text only).  I want to write a bit of code that will remove that shading (to white) on the Exit Macro for the Field.  I can do this for Cells, but don't know how to do it when just the TEXT is shaded.

Thanks :)

Mitchell
LVL 5
MitchellVIIAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GrahamSkanRetiredCommented:
It's another sorry, I'm afraid Mitch. That shading applied to all formfields together, not one at a time.
It's the button next to the padlock on the Forms toolbar, or it's this property:
ActiveDocument.FormFields.Shaded
0
MitchellVIIAuthor Commented:
You may have misunderstood what I am looking for.

What I am doing rather than using the FORM FIELD shading tool is selecting each field and shading them individually as TEXT rather than as a FormField.  That's why I though I might be able to change it, by adjusting the TEXT shading.

Couldn't I do something like tell Word to look for any Text in the active cell and shade it white?  That may work.

I don't use the built in Form Field Shader as it is too dark.

M

P.S., how do you refer to an InlineShape Object when tryin to pass it to a Sub as an Object when you know the shapes name?  I know we were able to get there with a For Each...Next Loop, but I can't seem to get it to work stand-alone.
0
GrahamSkanRetiredCommented:
OK. This should work as the exit macro

Sub ShadeFF()
    Dim rng As Range
    'Find the form field
    Set rng = Selection.Range
    Do Until rng.FormFields.Count > 0
        rng.MoveStart wdCharacter, -1
    Loop
    'Hightlight the range
    Select Case Trim$(rng.FormFields(1).Result)
        Case ""
            rng.Font.Shading.BackgroundPatternColor = wdColorGray15
        Case Else
            rng.Font.Shading.BackgroundPatternColor = wdColorWhite
    End Select
End Sub


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MitchellVIIAuthor Commented:
Sorry I'm slow getting back to you on this one Graham, great solution :)

Quick question.  I may go a slightly different direction, but not sure how to do it.

Let's say I have a FormField in a cell and I want to change the Cell Backcolor light gray when I enter the Field and, back to white when I exit the field.  How would that work?

Mitchell
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.