Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 19th, 2008, 09:12 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , .
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Grab Values From List Box into Text Box

Ok...I have a MS Words form. I created a textbox in this form.

The other thing that I have is a popup "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:
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

Reply With Quote
  #2 (permalink)  
Old June 19th, 2008, 09:19 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi Joe

Can you try

Private Sub CommandButton1_Click()
ActiveDocument.FormFields("Text1").Result = Me.ListBox1.Text
Unload Me
End Sub

Word Formfields have Text1 instead of TextBox1

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
  #3 (permalink)  
Old June 19th, 2008, 10:33 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , .
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i tried with "Text1" but still same error message. Somehow the codes is not applying what I have selected in the listbox into the textbox. Are my codes correct?

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
multi-column list box values moved to 2nd list box sbmvr Access VBA 1 May 14th, 2007 01:58 PM
How to get multiselect values from list box in jsp krishnamoorthymca JSP Basics 0 December 19th, 2006 02:13 AM
passing values from multiple list box tulincim Classic ASP Databases 22 October 6th, 2005 01:16 PM
passing values from multiple list box tulincim Javascript 4 September 14th, 2005 02:02 AM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM



All times are GMT -4. The time now is 12:34 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.