Setting text form field properties

D

Dawn R.

Does anyone know how to set the properties of a text form
field (ie, the fill-in field you can put in using
the "Forms" toolbar) using VBA? I'm one of those folks
making little macros with the macro recorder instead of
programming. Unfortunately, the only way that I know of
(or can find in help files) to set the text form field
properties is by double-clicking on the field to get the
dialog box to pop up. But, as you all know, the macro
recorder doesn't want to record anything mouse-based.

Any known keyboard or menu-driven way to get that field
form properties dialog box? Or if there are programming
ways to set these properties, maybe one of you kind souls
could try to tell me how?

Thanks in advance (the MVPs that respond to these emails
are so fantastic. I still can't beleive the amount of
time you're willing to devote to helping folks on this
board -- lucky for me!) Thanks!

--Dawn Rhoads
 
D

Dawn R.

Thanks... I tried looking at the help in Visual Basic
for "dialogs collection", which to be honest, is over my
head, but if I looked at it right, it seemed to be about a
way to get the dialog box to show up as part of the
macro? (presumably, to allow the user to make settings or
choices that they'd want?) That's not what I'm trying to
do in my case. I want to insert some text form fields in
my document, using a macro, that have certain properties.
In particular, I want a couple of the fields to have
default text. The only place I know to set that field
property in Word itself is with the dialog box, which I
can't get to while recording my macro, since the macro
recorder won't recognize the mouse clicks.

Sorry if I've missed the point of the help file. I'm one
of those folks who knows just enough about VBA to be a bit
dangerous, but I'm definitely no programmer.

Thanks again for any further light you might be able to
shed on this question!

--Dawn
 
J

Jezebel

No, read the help more closely. There are three basic things you can do with
dialogs:

1) display and act on the dialog (which is what Word normally does).
2) display the dialog but not take any action (your code can then read the
values the user entered and act on them however you like).
3) set the dialog values and 'do' the dialog action, without displaying it
at all (this is the one you want).
 
D

Dawn R.

Thanks again... I think I wasn't in the right help section
before (the help section I found on "dialogs collection"
was one page, not much detail, but was talking about
message boxes) I think I found the section you're
referring to (under "displaying built in Word dialog
boxes"?), but it's definitely beyond my ability to figure
out -- I don't have enough programming knowledge to even
read the darn help files! Dang! Thanks anyway for trying
to point me in the right direction, I appreciate your time.

--Dawn
 
D

Dawn R.

Wow, I spoke too soon. I did figure out how to do this
after looking at some anoter help file as well. The two
sections that helped were "Built in Word Dialog Boxes"
and "Built in dialog box argument lists".

So, for anyone else who might be interested, here's the
code I came up with that seems to work to set the default
text of a highlighted field:

With Dialogs(wdDialogFormFieldOptions)
.TextDefault = "1"
.Execute
End With

Thanks, Jezebel for putting me on the right track, I
appreciate it!

--Dawn
 

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