Using combo boxes

S

sanj

Hi,

I would like to add a combox to my slide that displays the following:

case study 1
case study 2
case study 3


etc then jump to a particular slide depending on what has been chosen from
the combobox

I think this code for selecting the index might work but I don't know how to
assign the above to a combobox etc


Private Sub ComboBox1_Click()
Select Case ComboBox1.Value

Case 0
With SlideShowWindows(1).View
.GotoSlide 3
End With

Case 1
With SlideShowWindows(1).View
.GotoSlide 3
End With

Case 2
With SlideShowWindows(1).View
.GotoSlide 3
End With
End Select

End Sub

Any help is appreciated
 
S

sanj

OK I think I go this to work, but, is there a way that I can run the
ComboBox1_Initialize() when viewing the slide rather than running from the
VB environment?

Private Sub ComboBox1_Initialize()
ComboBox1.Clear

ComboBox1.AddItem "Case Study 1"
ComboBox1.AddItem "Case Study 2"
ComboBox1.AddItem "Case Study 3"

End Sub

Private Sub ComboBox1_Click()

Select Case ComboBox1.ListIndex

Case 0
With SlideShowWindows(1).View
.GotoSlide 1
End With
Case 1
With SlideShowWindows(1).View
.GotoSlide 2
End With
Case 2
With SlideShowWindows(1).View
.GotoSlide 3
End With

End Sub
 
S

sanj

Thanks Steve,

I'm having problems with the following:

this code resides on the slide:

Private Sub ComboBox1_Initialize()
ComboBox1.Clear
ComboBox1.AddItem "This"
ComboBox1.AddItem "That"
ComboBox1.AddItem "The other"
ComboBox1.ListIndex = 0

End Sub

I receive an error:
----------------------------------------------------------------------------
------------
Compile error:

Object library invalid or contains references to object definitions that
could not be found
----------------------------------------------------------------------------
------------

Also for the follwoing code:

Private Sub ComboBox1_Click()
Select Case ComboBox1.ListIndex
Case 0
With SlideShowWindows(1).View
.GotoSlide 2
End With
Case 1
With SlideShowWindows(1).View
.GotoSlide 3
End With
Case 2
With SlideShowWindows(1).View
.GotoSlide 4
End With
Case Else
MsgBox "Unknown Value"
End Select
End Sub


However for the example you showed:
where I insert the code in a module and select the combobox and run the
following the information is updated:

Sub AddItemsToSelectedListBox()

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

With oShape.OLEFormat.Object
' Add items to the list
.AddItem ("This")
.AddItem ("That")
.AddItem ("The Other")
' You could work with other properties of the list or combo box here as
well
End With

End Sub


But then how do I get the slide to goto another slide based on the index?

Regards,

Sanjay
 

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