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.


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


Any1 knows ?? Thx in advance :D
 

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

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
 

Watch MrExcel Video

Forum statistics

Threads
1,118,760
Messages
5,574,079
Members
412,566
Latest member
TexasTony
Top