Print

Print


Private Sub PopulateListBox()
    Dim bPath As String, Pos As Long

    bPath = "c:\filepath\
    With frmBaskets.cmbBasketType
        MyName = Dir(bPath, vbDirectory)   ' Retrieve the first entry.
        Do While MyName <> ""   ' Start the loop.
            Pos = InStr(1, MyName, ".csv", vbTextCompare)    'looks for csv
files only
            If Pos > 0 Then
                MyName = Left(MyName, Pos - 1)
                .AddItem MyName
            End If
            MyName = Dir    ' Get next entry.
        Loop
    End With
End Su
  -----Original Message-----
  From: [log in to unmask]
[mailto:[log in to unmask]]On Behalf Of Jean-Yves Sarag
  Sent: Monday, July 05, 1999 10:21 AM
  To: [log in to unmask]
  Subject: Populating listbox


  hello,
  I have a problem for populating a listbox with items:
  In a folder , called c:\excel , I have excel files A.xls, B.xls,
C.xls,etc..  I want to poulate the list box
  with the items A, B, C , etc....
  The worksheet containing the X.xls is outside the C:\excel folder.
  How can you please do such integration ??
  Any help will be wonderfully appreciated .
  best regards /jean-yves