Populating a ListBox at runtime

K

kimkom

Hi All,

I've been using the following code to populate a ListBox. The trouble is it
doesn't populate when double-clicking the PPS file to view the slideshow. I
understand why it's not populating (since it has to be run while the ListBox
is selected in edit mode), just not sure how to make it work at runtime.

Anyone got any pointers on how to fix it?

Many thanks,
Michael


Sub AddItemsToSelectedListBox()

Dim oShape As Shape
Set oShape = ActiveWindow.Selection.ShapeRange(1)

With oShape.OLEFormat.Object
.Clear
.AddItem ("FORMATION 01")
.AddItem ("FORMATION 02")
.AddItem ("FORMATION 03")
.AddItem ("FORMATION 04")
.AddItem ("FORMATION 05")
End With

End Sub
 
K

kimkom

Thank you for the reply and advice Steve.

Unfortunately replacing the Set oShape line with your suggested format of:
Set oShape = ActivePresentation.Slides(4).Shapes("ListBox1")

does not populate the list. Any further advice anyone?

I am also wondering if this is the correct way to go, since I don't want to
'AddItem' every time the PPS is run. I merely want to create the list and
have it stay the same with each run.

Many thanks,
Michael
 
K

kimkom

I've managed to get this working fine now using Option Buttons instead of a
List Box.

Thanks,
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top