Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-11-2012, 02:27 PM
ll4u76 ll4u76 is offline Adding a long list of values to a combobox in Word 2003? Windows 7 64bit Adding a long list of values to a combobox in Word 2003? Office 2010 32bit
Novice
Adding a long list of values to a combobox in Word 2003?
 
Join Date: Mar 2012
Posts: 7
ll4u76 is on a distinguished road
Question Adding a long list of values to a combobox in Word 2003?

I have a list of over 50 value items that I want to add to my combobox in Word 2003. Please assist me on how I should type these values in VBA without getting a Compile Error: Syntax Error.

Here is an example of how I typed the code:

Me.ComboBox1.List = Split("item 1 | item 2 | .......") & _
("item 20 | item 21 |......") & _
("item 48 | item 49 | item 50", "|")



Please assist.
Reply With Quote
  #2  
Old 04-13-2012, 03:37 AM
macropod's Avatar
macropod macropod is offline Adding a long list of values to a combobox in Word 2003? Windows 7 64bit Adding a long list of values to a combobox in Word 2003? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try something along the lines of:
Code:
Dim StrItems As String, i As Long
StrItems = "|item 1|item 2|.......|" & _
"item 20|item 21|......|" & _
"item 48|item 49|item 50"
For i = 1 To 50
  Me.ComboBox1.AddItem Split(StrItems, "|")(i)
Next
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a long list of values to a combobox in Word 2003? Populating ComboBox or Drop Down list with contents of a text field Billy_McSkintos Word VBA 1 09-13-2011 05:50 AM
2010 Outlook Favorites list too long Emerogork Outlook 1 06-16-2011 05:05 PM
Adding a long column of time increments in seconds klippert Excel 1 09-18-2010 12:26 AM
Long List for drop down box DLo99 Word 0 02-28-2010 08:07 AM
Fields controlled by List box values farfromapro Word 0 02-11-2009 02:19 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:48 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft