How to select mutiple files ?

-=Kid=-

New Member
Joined
Nov 16, 2005
Messages
11
Hi,
I am now trying to select mutiple xls files to upload. But i can't seem to do it.

Here is the pop up box which allow them to select the option. When the upload file button is selected then Diagram 2 when appear.
PopUp.jpg


Now i am trying to allow the user to select mutiple xls files in Diagram 2.
Select.jpg


Any1 knows ?? Thx in advance :D
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

WillR

Well-known Member
Joined
Feb 18, 2002
Messages
1,143
try using

Code:
Application.GetOpenFilename(MultiSelect:=True)
 

-=Kid=-

New Member
Joined
Nov 16, 2005
Messages
11
Thx WillR 4 the reply.
But how do i get all the xls files url since they are unpredictable numbers of xls files which the user can upload ? How to know where to get all the url from the GetOpenFilename method ?

I just try using an array:

Dim str(3) As String

str(1) = Excel.Application.GetOpenFilename(filefilter:="(*.xls), *.xls", Title:="Extract File", ButtonText:=" ", MultiSelect:=True)

ListBox1.AddItem (strpath(1))
 

-=Kid=-

New Member
Joined
Nov 16, 2005
Messages
11
Oh ok, now i have done the multiple excel file upload using the GetFolder and SubForm method.

Here is my codes:
Code:
Private Sub SubDirs(StartPath)

    Dim fs, f, f1, sf
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder(StartPath)
    Set sf = f.SubFolders
    
    ' EACH SUB DIRECTORY
    For Each f1 In sf
    
        ' List all files in current dir
        Call FilesInPath("Report", f1.Path)
        
        ' Recursively go down the Dir tree
        Call SubDirs(f1.Path)
        
    Next f1
End Sub

Private Sub FilesInPath(SheetName, Path)
    Dim fs, f, f1, fc, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder(Path)
    Set fc = f.Files
    
    With Sheets(SheetName)

    For Each f1 In fc
    
    'NAME
    '.Cells(NxRw, 1).value = f1.name
    
    'PATH
    ListBox1.AddItem (f1.Path)
    Next
    End With
    End Sub

There will be a pop up box to ask for the directory.

Currently, all excel files are in C:\OPUS\MonthlyClocking

So, in the pop up box I enter "C:\OPUS" directory and all the files will be uploaded. If the C:\OPUS folder contain more than one folder it will upload all the other xls file which are not relevant.

but when i enter C:\OPUS\MonthlyClocking nothing will be upload

I want to read all the files in C:\OPUS\MonthlyClocking instead of reading the sub folders in C:\OPUS

Any1 know ?? Thx in advance :p
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,018
Messages
5,834,976
Members
430,331
Latest member
Syed Yasir Hannan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top