Personal website of Gregory K. Maxey, Commander USN (Retired)
Do you have ad-blocking software enabled? While I respect your right to do so, your donations and the minimal advertisements on this site help to defray internet and other costs of providing this content. Please consider excluding this website from blocking or turning off the blocker while browsing this site.
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!
The purpose of this Microsoft Word Tips & Microsoft Word Help page is to expand and amplify my popular Populate Userform ListBox or ComboBox tips page. While much of the information in that page is still helpful and relevant, this page is intended to offer improved methods and advanced functions in a consolidated single UserForm demonstration.
Here I will offer streamlined techniques for populating lists as well as functions for managing (sorting and positioning items contained in the list). While I am an "Old Dog," I've been learning some new tricks using SQL statements and the methods demonstrated here for populating list from Excel and Access rely solely on those statements.
To view and participate in the demonstration, you will need to download the following demonstration package: Demo Pack
After downloading the package, unzip and store all the contained files in a common folder. For illustrative purposes, I have stored all the package content files in a folder "C:\Demo"
After storing the files, open Word and open the file "Advanced List and CB Fill and Functions"
Note: The demonstration document is a Word macro-enabled document. If you did not save the files in a trusted location, when the document opens you may be prompted to enable content. If you don't enable content or if there is no prompt to enable content then the macros will be disabled and the demonstration will not work. Modify your trusted locations or security settings to ensure the content is enabled.
The document opens as shown below:
Double-click in the first "DC Here" MacroButton field to display the single column userform advanced functions.
Double-click in the second "DC Here" MacroButton field to display the multi-column userform fill and advanced functions. The presented UserForm contains six multi-column/multi-select ListBoxes. View each ListBox by selecting the multi-page control page tabs. Each ListBox is populated using different techniques and data sources.
Use the command buttons adjacent to the ListBoxes to demonstrate the advanced functions. The "OUTPUT" button generates a formatted output message string.
Clicking the SQL Query Examples tab presents a slightly different view. With this view you can populate the ListBox using one of four example SQL statements.
After clicking one of the examples, the definition of the data displayed in the ListBox and SQL statement used is provided.
Working on these demonstration UserForms, I realized that my demonstration document in Populate Userform ListBox or ComboBox had grown unwieldy. Wanting to fix that without losing the individual UserForms displayed in the tips page, I consolidated that material in the following demonstration package: Demo Pack
As with the previous demo pack, unzip all of the packaged files into a common folder. Open Word and open the file "Populate UserForm LB or CB (Consolidated)"
The document opens as shown below:
Simply double-click any of the various Macrobutton fields, to display the demonstration userform.
1. While the code contained in these demonstrations represent a collection of considerable knowledge, it is not all knowledge learned or obtained through my own efforts. I still consider myself a compete novice when it comes to Excel and Access and the area of SQL statements is one I've just discovered. There is a lot to learn there.
2. The truth is that much of the knowledge is knowledge shared with me or developed in collaboration with others. MVP Doug Robbins has spoon fed Access and Excel interoperability for as long as I remember; much of the ListBox functions is adapted from material published by Excel guru Chip Pearson; and of course MVP Graham Mayor who has struggled over a lot of it with me over the years. There are others too numerous to mention. Thank you all!!
That's it! I hope you have found this tips page useful and informative.
Do you want to make a payment for consulting work or donate to help support this site?
PayPal is a safe, easy way to pay online.
Use the appropriate currency "Donate" button to make a payment or donation.