Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2005

Tip: Looking for answers? Try searching our database.

ComboBox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Viall - 15 Apr 2005 23:42 GMT
I tried using the built-in drop down list function to store a list of 36
names, but received an error stating it could only hold 25.  So I have added
a VBA ComboBox, but how can I load the data in when the document is first
loaded?

I tried:
Sub AutoNew()
   ComboBox1.AddItem "Name 1"
   ComboBox1.AddItem "Name 2"
   ComboBox1.AddItem "Name 3"
   ComboBox1.AddItem "Name 4"
End Sub

Any help would be appreciated.

John
vaportrailsf - 20 Apr 2005 20:15 GMT
On a different thread someone posted this link which i think will help you.
http://support.microsoft.com/default.aspx?scid=kb;en-us;253542

> I tried using the built-in drop down list function to store a list of 36
> names, but received an error stating it could only hold 25.  So I have added
[quoted text clipped - 12 lines]
>
> John
Dian D. Chapman, MVP - 22 Apr 2005 23:38 GMT
Close, but you need to add the code into the UserForm#_Initialization
event. This way when the dialog box is initialized (prepares to open)
it will run various events to do whatever you need to "prepare" the
information...one of which will be to load the combo box with your
list.

Double click on your UserForm to go into that code module and click
the left drop down in the code and choose USERFORM. Then...on the
right side drop down, you'll see the available events for the
form...one will be initialize. Add your ComboBox1.AddItem "Name 1"
codes into that event.

Then, of course, you'll need to call the dialog box to display...which
can be done by calling UserForm1.Show (or whatever your dialog box is
called) in the location where you'll need the form to display. If you
want it displayed when a new document is created from your form
template...put the show code into the ThisDocument_New procedure.

Hope this helps...

Dian D. Chapman, Technical Consultant
Microsoft MVP, MOS Certified
Editor/TechTrax Ezine

Free MS Tutorials: http://www.mousetrax.com/techtrax
Free Word eBook: http://www.mousetrax.com/books.html
Optimize your business docs: http://www.mousetrax.com/consulting
Learn VBA the easy way: http://www.mousetrax.com/techcourses.html

>I tried using the built-in drop down list function to store a list of 36
>names, but received an error stating it could only hold 25.  So I have added
[quoted text clipped - 12 lines]
>
>John
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.