Field Codes

F

frogman

I am using Word 2002
I have a field code (field on the insert drop down) that on click needs
to select the field (1 or more words) and then if the user starts
typing the text needs to change color and format.

I am new to field codes so i need lots of help
 
C

Charles Kenyon

If you are talking form fields, you can't do this. You can have drop-down
fields that people select things from (in a document protected for forms) or
that they type into.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
F

frogman

I have half of the problem solved.
{MACROBUTTON ClearFormatting ___ Insert number }

this takes the formatting off if the field is clicked.

The user wants the field to be red until the user starts typing.

I have written a macro in Word to do this but when I use the macro if
the field has more than one word it put "" around the text. If I could
get rid of the "" that would be great also.
 
C

Cindy M -WordMVP-

<[email protected]>
<[email protected]>
Newsgroups: microsoft.public.word.vba.beginners
NNTP-Posting-Host: 10.90.3.213.cust.bluewin.ch 213.3.90.10
Path: number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.news2me.com!newshub.sdsu.edu!msrtrans!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
Lines: 1
Xref: number1.nntp.dca.giganews.com microsoft.public.word.vba.beginners:27886

Hi Frogman,
I have half of the problem solved.
{MACROBUTTON ClearFormatting ___ Insert number }

this takes the formatting off if the field is clicked.

The user wants the field to be red until the user starts typing.

I have written a macro in Word to do this but when I use the macro if
the field has more than one word it put "" around the text. If I could
get rid of the "" that would be great also.
Show us the macro code you're using...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
F

frogman

I have been fighting with this for awhile.

First problem:
I have fields that are red so the user knows he has to put a value in
that field and if he clicks final and scrolls through the document and
sees red text he has to go back and fix those entries.

First solution:
macrobutton to clear formatting on click.

Second problem:
works great if user types the info but if he decides to click somewhere
else the field text stays black.

Second solution:
This code finds the field index and stores it then changes the text
back to red if the field remains if the file is gone (user typed over
the field) (message box for debug purposes) continue.
The piece I am missing is how to activate the first part of the code to
store the field index then if the user clicks somewhere else and the
field remains to change the field back to red text.

Sub ChangeRedTextBack()
Dim intFieldIndex As Integer

On Error GoTo ErrHandle

intFieldIndex = Selection.Fields.Item(1).Index

If ActiveDocument.Fields.Item(intFieldIndex).Result.Font.Color <>
wdColorRed Then
ActiveDocument.Fields.Item(intFieldIndex).Select
Selection.Font.Color = wdColorRed
End If

ErrHandle:
If Err.Number = 5941 Then
MsgBox "No field selected." & vbCr & "Please select a field.",
vbInformation
End If

Err.Clear

End Sub

Thanks for the help
 
G

Greg

Frog,

Try something like:

{ Macrobutton NoMacro {Quote "_____ Insert Number" \* CharFormat}}

Before toggling the field code format the "Q" in "Quote" as red text.
Toggle and update fields. The text "______ Insert Number" should be
red. If a user clicks and types the format will be whatever format was
applied at the field insertion point. If the don't type and go
somewhere else it will stay red.
 

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