Display a userform with Listbox1 data in a Word document ?

chazrab

Well-known Member
Joined
Oct 21, 2006
Messages
917
Office Version
  1. 365
Platform
  1. Windows
Title should hopefully be clear - I have a 2 column table in Word I'd like to display as a Listbox in a userform - but in Word.
This userform in Excel is shown below. How would you display this in a Word doc from a button click?
I've gotten as far s creating a userform in Word with a listbox control and a textbox. but can't figure out where the Rowsource property would come from

I hope this is clear - just display a userform with listbox data in a Word doc. Where would/could the Rowsurce data come from 0
would it have to be a link to an Excel named range on a sheet in a workbook or can it be from a table within Word ?

Please someone help if you can. Seems simple enough, I just can't figure it out yet
Thanks for anyone's help.
cr
LISTBOX USERFORM.PNG
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I clicked on this link. It just describes how ro use XL2BB to display a spreadsheet in a thread. Again, the question I have is this:
where does the Listbox1 Rowsource,(that is the data) come from when creating a userform with a Listbox1 in Word VBA ?
The image above is exactly what I want but it's in Excel. I want to be able to
1 . either use Rwosource data from a Word table ideally, if that's possible or,
2. open it from a button in a Word doc. which is the least desirable preference.
cr
 
Upvote 0
Upvote 0
@chazrab
Is it possible you clicked the word "This" in my signature, and not the word "This" in my post?

The green word "This" in my post contains the link which will take you to the helpful page in question, which appears to deal directly with your request.
 
Upvote 0
Hi Sykes - you are exactly correct - my mistake - I'm always in too much of a hurry to accomplish things - these days especially - anyway, Paul Edstein,
commented and included the exact same link.

That is an EXCELLENT link Very clear and complete, using commented out statements to explain code steps

After reading the code and substituting values for my data the code, it works great. I sued data from an Excel sheet. The one thing I did add to their code was
Code:
Application.screenupdating = False at the beginning of the code and reset to true right before the End Sub line.  Runs much faster.

My Word doc which had a 31 row table and has now evolved into a 2 column listbox on a userform which opens from a button in Word - which I plan to put on the QAT. This makes any Word doc which has tables much, much more enjoyable for anyone writing a book..

...which brings up another question: I wonder if a book written for and read through the Kindle app would also have the capability of displaying a userform
with a listbox from a button click instead of having the reader pour through a long table? The source doc in this case would have to be from a table created in Word and not an external link like an Excel spreadshseet = I'm sure somebody reading this with extensive knowledge like Greg Maxey and/or Doug Robins would know. Anyway - I think it is a worthwhile question.

Thanks again for all your help.
cr
Kingwood, Texas
04.27.20 6:36 AM CST
 
Upvote 0
Pleasure. Glad we could be of help, and thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,661
Messages
6,173,647
Members
452,525
Latest member
DPOLKADOT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top