Word Form

E

Eric

I want to create a form in a word document and was
wondering how I can access the controls from the VBE.

I've been searching all over the net for a solution. There
are a lot of documentation about accessing controls which
are created on a user form, but couldn't find any about
accessing controls on a document.

I want to cycle through all the controls on the document
and give it another value. On a Userform in Word and in
Access, I would do the following.

Dim Ctrl as Control
For Each Ctrl In SomeFormName.Controls
Ctrl.SomeProperty = SomeValue
Next

This however does not work when the controls are on a word
document.

I've tried using ThisDocument.Controls but does not
recognise this as a method or property.

Any help with this is appreciated.
 
S

Stan Scott

Eric,

Very bad documentation, isn't it?? Read through Word Help for the "Shapes"
collection and the "InlineShapes" collection. As an example, if I put a
Checkbox and an Option button on a document,
"ActiveDocument.InlineShapes.Count" will return 2.

Hope this helps,

Stan Scott
New York City
 
J

Jezebel

Each formfield has a bookmark associated with it: right-click the formfield
and select properties to see/change the bookmark names. You can refer to and
iterate these from code to read and set the form field values.
 
E

Eric

I can't find anything on shapes or inlineshapes in Word
Help.

I might have to do more digging on the net.
 
J

Jezebel

Try Word's VBA help ... these objects are fully documented. Or use the
ObjectBrowser ... select the object, then press F1.
 

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