Consulting

Results 1 to 2 of 2

Thread: Add some .avi files in a ListBox

  1. #1
    VBAX Regular
    Joined
    Aug 2007
    Posts
    16
    Location

    Add some .avi files in a ListBox

    Hi guys ,

    Do you know how to add some media files in a listbox. So I have some media files saved in a folder. Now I want to add them all in the UF. When I select one of them from the listbox, a hyperlink to the file in that folder should be made.

    10x
    metev

  2. #2
    VBAX Tutor
    Joined
    Aug 2007
    Posts
    273
    Location
    try this

    [VBA]Sub testing()
    userform1.listbox1.List = list1(Path, "avi", True)
    End Sub

    Function list1(location As String, filetype As String, search_subfolder As Boolean)
    Dim a As Long, b As Long
    ReDim c(0 To 0) As String
    a = 1
    b = 0
    With Application.FileSearch
    .LookIn = location
    .filetype = msoFileTypeAllFiles
    .SearchSubFolders = search_subfolder
    If (.Execute <> 0) Then
    While a <= .FoundFiles.Count
    c(b) = .FoundFiles.Item(a)
    If LCase(Right(c(b), 3)) = filetype Then
    b = b + 1
    ReDim Preserve c(0 To b) As String
    End If
    a = a + 1
    Wend
    End If
    End With
    list1 = c
    End Function
    [/VBA]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •