SUB test(anyparam) -- VBA does not allow params!?

J

Jay Freedman

Oops, slight correction... see below.

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.
 
S

Sven

Thanks, Jay, :O)
yes, I am still reading and your explanation was very sufficient. Now I
understand the whole thing much better.
 

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