Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Display Modes
  #1 (permalink)  
Old August 4th, 2015, 02:29 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2015
Location: Sacramento, CA
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.
Code:
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.
Reply With Quote
Reply


Thread Tools
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
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



All times are GMT -4. The time now is 04:01 AM.


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