Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 24 Jan 2006 16:06:47 -0800,    group: microsoft.public.word.word97vba        back       


Userforms on Word Documents   
I've created a word document that is like a form and I use this form on a 
daily basis at work.  I am trying to make my life easier at work.  I have 
built a userform with white text boxes for a word document that contains 
formfields.  Can someone please share a code that may work.  I would like to 
type in some text in the white boxe(s) on the userform and it will send that 
paticular text to the specified formfield.  The white text box(s) should have 
the same value or text in the formfield.  Example:  white text box on the 
userform is called "txtname" and the formfield or bookmark on the word 
document is called "Text1".  When I type the name David in the white text box 
called "txtname" and I then click a button that submitts it.  I would like 
for word to send the name David, that is contained in "txtname", to the 
formfield called "Text1".  Both "txtname" and "Text1" should have the same 
Name as David.  I've tried several diffent codes and they will not work.  
I've tried everything and nothing seems to work.  The code below is an 
example of what I've tried but it will not work.  Your help is appreciated, 
please give me your input.

Example(s) that will not work:
ActiveDocument.FormFields(Text1) = txtname
ActiveDocument.Forms(Text1) = txtname
Text1.value = txtname
txtname.value = Text1
ActiveDocument.Bookmarks(Text1) = txtname
date: Tue, 24 Jan 2006 16:06:47 -0800   author:   vdodd

Re: Userforms on Word Documents   
See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

You use the .Result property of a formfield to assign something to it as 
shown in the following code:

ActiveDocument.Formfields("Text1").Result = txtname

I would suggest however that you use the same name for the bookmark assigned 
to the formfield as that as that of the name of the control on the userform.

ActiveDocument.Formfields("txtname").Result = txtname
-- 
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

"vdodd"  wrote in message 
news:500C40DE-FCAA-4316-B6BF-FDC51429B8F9@microsoft.com...
> I've created a word document that is like a form and I use this form on a
> daily basis at work.  I am trying to make my life easier at work.  I have
> built a userform with white text boxes for a word document that contains
> formfields.  Can someone please share a code that may work.  I would like 
> to
> type in some text in the white boxe(s) on the userform and it will send 
> that
> paticular text to the specified formfield.  The white text box(s) should 
> have
> the same value or text in the formfield.  Example:  white text box on the
> userform is called "txtname" and the formfield or bookmark on the word
> document is called "Text1".  When I type the name David in the white text 
> box
> called "txtname" and I then click a button that submitts it.  I would like
> for word to send the name David, that is contained in "txtname", to the
> formfield called "Text1".  Both "txtname" and "Text1" should have the same
> Name as David.  I've tried several diffent codes and they will not work.
> I've tried everything and nothing seems to work.  The code below is an
> example of what I've tried but it will not work.  Your help is 
> appreciated,
> please give me your input.
>
> Example(s) that will not work:
> ActiveDocument.FormFields(Text1) = txtname
> ActiveDocument.Forms(Text1) = txtname
> Text1.value = txtname
> txtname.value = Text1
> ActiveDocument.Bookmarks(Text1) = txtname
>
>
>
date: Wed, 25 Jan 2006 05:59:24 +0100   author:   Doug Robbins - Word MVP

Re: Userforms on Word Documents   
Thanks Doug for your help.  That solved my problem.

"Doug Robbins - Word MVP" wrote:

> See the article "How to create a Userform" at:
> 
> http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm
> 
> You use the .Result property of a formfield to assign something to it as 
> shown in the following code:
> 
> ActiveDocument.Formfields("Text1").Result = txtname
> 
> I would suggest however that you use the same name for the bookmark assigned 
> to the formfield as that as that of the name of the control on the userform.
> 
> ActiveDocument.Formfields("txtname").Result = txtname
> -- 
> 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
> 
> "vdodd"  wrote in message 
> news:500C40DE-FCAA-4316-B6BF-FDC51429B8F9@microsoft.com...
> > I've created a word document that is like a form and I use this form on a
> > daily basis at work.  I am trying to make my life easier at work.  I have
> > built a userform with white text boxes for a word document that contains
> > formfields.  Can someone please share a code that may work.  I would like 
> > to
> > type in some text in the white boxe(s) on the userform and it will send 
> > that
> > paticular text to the specified formfield.  The white text box(s) should 
> > have
> > the same value or text in the formfield.  Example:  white text box on the
> > userform is called "txtname" and the formfield or bookmark on the word
> > document is called "Text1".  When I type the name David in the white text 
> > box
> > called "txtname" and I then click a button that submitts it.  I would like
> > for word to send the name David, that is contained in "txtname", to the
> > formfield called "Text1".  Both "txtname" and "Text1" should have the same
> > Name as David.  I've tried several diffent codes and they will not work.
> > I've tried everything and nothing seems to work.  The code below is an
> > example of what I've tried but it will not work.  Your help is 
> > appreciated,
> > please give me your input.
> >
> > Example(s) that will not work:
> > ActiveDocument.FormFields(Text1) = txtname
> > ActiveDocument.Forms(Text1) = txtname
> > Text1.value = txtname
> > txtname.value = Text1
> > ActiveDocument.Bookmarks(Text1) = txtname
> >
> >
> > 
> 
> 
>
date: Wed, 25 Jan 2006 20:34:03 -0800   author:   vdodd

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us