J
Jay Freedman
Oops, slight correction... see below.
This should say that Selection.FormFields.Count is zero.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
Jay said:Hi Sven,
I'm glad you got it working.
In case you're still reading, maybe I can clear up your confusion:
Every form field (text, check box, or dropdown) has a built-in
bookmark that serves as its identifier. When you open the form
field's Properties dialog, the Bookmark item in the dialog lets you
change that name.
The check box and dropdown types of form field are well-behaved. That
is, if the Selection object contains one of these fields, the VBA
expression Selection.FormFields(1) points to the form field. Then
Selection.FormFields(1).Name contains the form field's name.
The text form field is not well behaved. That is, if the Selection
object contains a text form field, then the expression
Selection.FormFields(1) causes an error and the value of
Selection.FormFields(1).Count is zero. The workaround in the article
This should say that Selection.FormFields.Count is zero.
consists of getting the name of the form field's built-in bookmark
from the Selection.Bookmarks collection.
The workaround shouldn't be necessary, but it's been required in every
version of Word since the introduction of VBA in Word 97.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.