ListCount
If ActiveSheet.ListBoxes("ListBox1").Selected(i) Then strLB = strLB & etc.etc.
Next i
MsgBox(ListBox1.List(lItem))
End If
Next
End Sub
To get the value of the selected item of a listbox then use the following.
Dim t As Task
Dim pj As Project
Dim i As Integer
Set pj = ActiveProject
xlApp.Visible = True
AppActivate "Excel"
'x is the duration of task in days(i.e. half a day long task is 0.5)
x = t.Finish - t.Start
'Loop to add day of week headers and color cells to mimic Gantt chart
For i = 0 To x
xlSheet.Cells(t.ID + 4, (7 * i) + 6).Interior.ColorIndex = 37
xlSheet.Cells(t.ID + 4, (7 * i) + 7).Interior.ColorIndex = 37
xlSheet.Cells(t.ID + 4, (7 * i) + 8).Interior.ColorIndex = 37
xlSheet.Cells(t.ID + 4, (7 * i) + 9).Interior.ColorIndex = 37
xlSheet.Cells(t.ID + 4, (7 * i) + 10).Interior.ColorIndex = 37
xlSheet.Cells(t.ID + 4, (7 * i) + 11).Interior.ColorIndex = 37
Next i
Next t
End Sub