UserForms to Populate FormFields

J

Jeff

I would like to use UserForms to Populate formfields rather then bookmarks is
ths Possible? or is there a way for the bookmaks to hold a specific section
of a document without disturbing the rest?

With ActiveDocument
.Bookmarks("tklarm1").Range _
.InsertBefore TextBox1
.Bookmarks("tklarm2").Range _
.InsertBefore TextBox2
End With

UserForm14.Hide
 
D

David Sisson

Yes, you can, but you will not gain any advantage with document flow
as the text will flow just like a bookmark, and, in addition, you'll
have to protect the document, or at least the section the formfield is
in.

Usually, the way I control document flow, is with tables.

Could you elaborate a little on what you're trying to prevent?
 
F

fumei via OfficeKB.com

David is quite correct. Text going into a bookmark, is just that...text. It
will flow normally.

Formfields, yes, it is true you can - to a certain extent - use as structural
elements in text flow, but they can have their own issues.

Tables are indeed useful to handle some text flow issues.

I would go along with David and ask, what - exactly - is the issue? What are
you trying to either prevent, or perhaps, even cause?
 
F

fumei via OfficeKB.com

Sorry, but actually answer your question.

Yes.

Userforms can put content into formfields very easily. Simply use the .
Result property of the formfield.

On userform: a control Textbox1
In document: text formfield named "Yadda"

In userform code:

ActiveDocument.Formfields("Yadda").Result = Textbox1.Text

Viola. The formfield "Yadda" will be Textbox1.Text

If you indtend to make lots of formfields, I would make a formfield object,
and a collection of them.
 
J

Jeff

I have a document with text I want to remain constant. I need the constant
text not to move when the bookmarks are populated. I have limited knowlede
using VBA so code snippets would be very much apprecatied. I will try using
tables to prevent this while waiting for a response. Thanks for the help.
 
D

Doug Robbins - Word MVP

The usual way to stop things moving is to use a table with fixed cell
dimensions.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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