Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

UserForms in document  templates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
natanz - 20 Jul 2005 21:40 GMT
as a matter of design, if you are using a userform to collect some
information that will then be fed into a template, what is the best
approach if someone wants to revise some of that info.  Do you bring up
the UserForm again, or do you just leave the user on their own.

In my template i have the user pick a job number, or a job name, and
then fill in the other in some form fields in the document.  Once the
userForm is gone, i have disconnected from the data source, so I don't
know how to match data 1 with data 2 without restarting the whole
userform, but that seems like it could be pretty onerous.

any thoughts?
Charles Kenyon - 20 Jul 2005 22:31 GMT
I restart the userform, picking up the previous answers from the document
where they were inserted. An alternative would be to save document variables
and work with those.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> as a matter of design, if you are using a userform to collect some
> information that will then be fed into a template, what is the best
[quoted text clipped - 8 lines]
>
> any thoughts?
Doug Robbins - 20 Jul 2005 23:14 GMT
Even then, I would load the data stored in the document variables back into
the userform.  If it is likely that the data will need to be changed, it is
better to use document variables rather than bookmarks.

Signature

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

>I restart the userform, picking up the previous answers from the document
>where they were inserted. An alternative would be to save document
[quoted text clipped - 11 lines]
>>
>> any thoughts?
natanz - 21 Jul 2005 01:28 GMT
i guess i am not sure what you mean by document variables.  can you
show me or direct me to a quick example?
Doug Robbins - 21 Jul 2005 04:58 GMT
Say you have a textbox on the userform with the name of txtFName, then in
the code in the userform that causes the data to be transferred into the
document use

With ActiveDocument
   .Variables("varFName").Value = txtFName.Text
   .Variables(etc. for the remaining data)

   .Fields.Update
End With

In the document you need to have a { DOCVARIABLE varFName } field.  The
.Fields.Update statement will cause it to display the data that was entered
into the txtFName textbox.

To reload the data into the userform, in the Initialise event, use

txtFName = ActiveDocument.Variables(varFName).Value

Signature

Hope this helps.

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

> Even then, I would load the data stored in the document variables back
> into the userform.  If it is likely that the data will need to be changed,
[quoted text clipped - 15 lines]
>>>
>>> any thoughts?
Charles Kenyon - 21 Jul 2005 13:49 GMT
I agree, I do repopulate the userform with existing data. Making the user
reenter everything to make a few changes makes for very unhappy users. My
primary userform is set to glean data from other files (at styles) and
insert the data into the new file at the same styles so I use the same code
to pull it back out. Otherwise, I use document variables and fields.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> Even then, I would load the data stored in the document variables back
> into the userform.  If it is likely that the data will need to be changed,
[quoted text clipped - 15 lines]
>>>
>>> any thoughts?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.