Word Fields

A

annu

How do we recognize if the user is within a field in word? When the cursor is
located
within a field, and I specify following in vba:
ActiveDocument.Application.Selection.Fields.Count
I get 0, yet the cursor is located within a field

I only get a correct count, if the entire field is selected, how do I detect
that the cursor is located within the context of a field?

Thx.
 
J

Jay Freedman

Hi annu,

Have a look at the code in
http://word.mvps.org/FAQs/TblsFldsFms/GetCurFmFldName.htm for a
possible method.

If the entire document is protected for forms, then the cursor cannot
be anywhere except in a form field of some kind. If some sections of
the document are unprotected, then the method in the article may not
be reliable (the cursor could be inside a regular bookmark that isn't
associated with a field).
 
A

annu

Hi Jay

thx for the feedback. I wasn't talking about form fields, just the
normal fields in word.
 

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