Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 4th, 2015, 02:29 PM
Registered User
Join Date: Aug 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Word 2013 VBA Listbox Issue

It's been about 20 years since I programmed in VBA and I am having a problem populating a listbox on a user form.

I have a couple of macros I run that I have put on the toolbar in Word 2013. I need to import them to Word 2016 on a Mac, but the option to customize the toolbar isn't available. So, I need to create a macro menu that I can use to call the various options.

I have created a user form with a single list box control. When I run the macro the form appears but the control is empty. I have tried every way imaginable to populate the form, but when I run the code I get the form with an empty list box.

Here is my current iteration for just the simple task of putting the rows on the list box. MainMenu is the form, MainMenuList is the listbox. I have tried multiple options for the sub name including _Initialize and a nonambiguous name with no options such as MainSub. Nothing works. I even tried MainMenu_Click() and clicked on the listbox and form, but no go.
Option Explicit
Private Sub MainMenu_Load()
MainMenuList.AddItem "Books" MainMenuList.AddItem "Censuses"
End Sub
I will then use the list to call up another form with another list of items to work with. The code beyond that point works fine, but how do I get the menus to work?

I've been able to emulate this using command buttons, but with a census every 10 years from 1790 to 1940, that's a lot of buttons to code. I have been searching and coding for two days and have not found anything to help me create a menu.

Any suggestions?

Last edited by JimWalton7; August 4th, 2015 at 02:33 PM..

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel auto export .dbf file through VBA - OFFICE 2013 woes Drivium Excel VBA 0 July 25th, 2013 10:57 AM
insert listbox items into word table rows bitex Word VBA 1 July 16th, 2011 12:07 PM
Search for listbox item in word table and delete the rows bitex Word VBA 4 July 11th, 2011 09:42 AM
Load a listbox from a word file list Davefeno VB.NET 1 June 22nd, 2011 01:15 AM
word wrap in listbox vjyrakesh C# 2005 1 May 22nd, 2008 09:39 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.