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: Thu, 19 Jun 2008 22:55:00 -0700,    group: microsoft.public.word.vba.beginners        back       


Pass ListBox Values into TextBox1 Field   
Ok...I have a MS Words form. I created a textbox in this form. 

The other thing that I have is a "UserForm" with a listbox. 

When an user select any one value from this listbox, I want that value to 
populate the "textbox". 

Here are my codes(in UserForm): 
Private Sub CommandButton1_Click()
ActiveDocument.FormFields("TextBox1").Result = Me.ListBox1.Text
Unload Me
End Sub

WHen I run this, I get an '5941' error message. Please advise what I am 
doing wrong. 

Thank you. 
Joe
date: Thu, 19 Jun 2008 22:55:00 -0700   author:   joesmithf1

Re: Pass ListBox Values into TextBox1 Field   
Using

ActiveDocument.FormFields("TextBox1").Result = ListBox1.Value

will set the .Result of the TextBox1 formfield to the value of the item that 
is in the BoundColumn of the currently selected item in the ListBox1
-- 
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

"joesmithf1"  wrote in message 
news:9D4C66D0-9010-4D25-8398-DC42127DE244@microsoft.com...
> Ok...I have a MS Words form. I created a textbox in this form.
>
> The other thing that I have is a "UserForm" with a listbox.
>
> When an user select any one value from this listbox, I want that value to
> populate the "textbox".
>
> Here are my codes(in UserForm):
> Private Sub CommandButton1_Click()
> ActiveDocument.FormFields("TextBox1").Result = Me.ListBox1.Text
> Unload Me
> End Sub
>
> WHen I run this, I get an '5941' error message. Please advise what I am
> doing wrong.
>
> Thank you.
> Joe
date: Fri, 20 Jun 2008 18:53:56 +1000   author:   Doug Robbins - Word MVP

Google
 
Web ureader.com


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