D
dirk
I have put a listbox item on my word document and put the following code in
VB :
Private Sub Document_Open()
ListBox1.AddItem ("item 1"), 0
ListBox1.AddItem ("item 2"), 1
ListBox1.AddItem ("item 3"), 2
ListBox1.AddItem ("item 4"), 3
End Sub
Private Sub ListBox1_Click()
If ListBox1.ListIndex = 1 Then
MsgBox ("this is item 2"), vbOKOnly
If ListBox1.ListIndex = 3 Then
MsgBox ("this is item 4"), vbOKOnly
End If
End If
End Sub
My question : this code only works when I click item 2.
what is wrong please??
VB :
Private Sub Document_Open()
ListBox1.AddItem ("item 1"), 0
ListBox1.AddItem ("item 2"), 1
ListBox1.AddItem ("item 3"), 2
ListBox1.AddItem ("item 4"), 3
End Sub
Private Sub ListBox1_Click()
If ListBox1.ListIndex = 1 Then
MsgBox ("this is item 2"), vbOKOnly
If ListBox1.ListIndex = 3 Then
MsgBox ("this is item 4"), vbOKOnly
End If
End If
End Sub
My question : this code only works when I click item 2.
what is wrong please??