Results 1 to 3 of 3

Thread: getting all files in a folder

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Posts
    221

    getting all files in a folder

    can you tell your program to open every file in a folder or would you have to know the names of the files?

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: getting all files in a folder

    You can have the program find the names of the files, but you can only open a file if you know its name. You can't use a wildcard in an Open statement.

  3. #3
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: getting all files in a folder

    Hi again

    If you'd add a FileListBox, you could set the path (and pattern if you'd only like to run a specific type of file) and then in an array run all the files
    VB Code:
    1. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    2. 'ShellExecute is an API to execute files
    3. Const SW_SHOWNORMAL = 1
    4.  
    5. Private Sub Form_Load()
    6.     File1.Path = YOURFOLDER
    7.     DoEvents
    8.     For i = 0 to File1.ListCount - 1
    9.        ShellExecute Me.hwnd, vbNullString, File1.List(i) , vbNullString, File1.Path, SW_SHOWNORMAL
    10.     Next i
    11. End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width