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 / Document Management / May 2008

Tip: Looking for answers? Try searching our database.

combo box populate

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MEME - 10 May 2008 21:17 GMT
Hi,

I'm  trying to add some values to my combo box. I have been reading how to
it, but it is not working.

Private Sub document_open()

Dim arrItems(4)
arrItems(0) = "Black"
arrItems(1) = "Blue"
arrItems(2) = "Green"
arrItems(3) = "Red"

ComboBox1.List = arrItems

end sub

IT is empty. What would be?  Am I missing some switch to activate this
routine?

Thank you very much
Signature

meme

Robert Martim, Excel - 12 May 2008 14:04 GMT
MEME,

I am assuming this combobox of yours is placed on a userform. If that is so,
then:

Private Sub UserForm_Initialize()

 Dim arrItems(3)
 arrItems(0) = "Black"
 arrItems(1) = "Blue"
 arrItems(2) = "Green"
 arrItems(3) = "Red"
 
 ComboBox1.List = arrItems()
End Sub

Signature

Robert
Author of RibbonX: Customizing the Office 2007 Ribbon:
LATEST INTERACTIVE TUTORIAL:
http://www.msofficegurus.com/videos/StepByStep_HT_Chart.asp
FORUM: http://www.msofficegurus.com/forum/

MEME - 17 May 2008 20:05 GMT
Hi Robert,

it is not in a userform. It is a template. I have tried document_open() and
document_new() . The combo box is empty.

Thanks
MEME

Signature

meme

> MEME,
>
[quoted text clipped - 11 lines]
>   ComboBox1.List = arrItems()
> End Sub
Doug Robbins - Word MVP - 17 May 2008 22:15 GMT
Use:

With ActiveDocument.InlineShapes(1).OLEFormat
   .Activate
   Set myObj = .Object
End With
With myObj
   For i = 1 To 3
       .AddItem "Item" & i
   Next i
End With

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hi Robert,
>
[quoted text clipped - 21 lines]
>>   ComboBox1.List = arrItems()
>> End Sub
MEME - 18 May 2008 13:54 GMT
Hi,

Thank you for your reply. I don't understand where should I have this code.
(document_open() document_new())
Once again thanks
MEME

Signature

meme

> Use:
>
[quoted text clipped - 33 lines]
> >>   ComboBox1.List = arrItems()
> >> End Sub
Doug Robbins - Word MVP - 19 May 2008 07:07 GMT
How are you planning to use the document?

If you are going to use it as a template, put that code inside a
Document_New() routine.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hi,
>
[quoted text clipped - 42 lines]
>> >>   ComboBox1.List = arrItems()
>> >> End Sub
 
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.