View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
StephanieH StephanieH is offline
external usenet poster
 
Posts: 95
Default MultiSelect ListBox

Sorry about that. I was thinking since my area of concern seemed to shift, I
should re-enter it under the new topic. I should have known you folks were
better than that and it wasn't necessary. Thanks for your help.

"Dave Peterson" wrote:

You have a reply in .misc, too.

StephanieH wrote:

I have a ListBox populated thru code as:
Sub UserForm_Initialize()
With ListBox1
.AddItem "AttyAdec"
.AddItem "2004"
.AddItem "Dialer"
.AddItem "Blank"
End With
ListBox1.ListIndex = 0
End Sub
With my OK Command as follows:
Private Sub OKButton_Click()

Msg = "You selected" & vbCrLf
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
Msg = Msg & ListBox1.List(i) & vbCrLf
End If
Next i
MsgBox Msg

If ListBox1.ListIndex = 0 Then

ChDir "C:\Documents and Settings\A092048\Desktop"
Workbooks.Open Filename:= _
"C:\Documents and Settings\A092048\Desktop\AttyAdec 090304.xls"

End If

If ListBox1.ListIndex = 1 Then

Workbooks.Open Filename:="C:\Documents and
Settings\A092048\Desktop\2004.xls"
End If

If ListBox1.ListIndex = 2 Then

Workbooks.Open Filename:= _
"C:\Documents and Settings\A092048\Desktop\Dialer.xls"
End If

Unload UserForm1
End Sub

My ListBox is set to 1 = fmMultiSelectMulti but when I select more than one
file, only the last file selected will open. Is there something else I need
to change for it to open more than one file at a time?


--

Dave Peterson