# Visual Basic > Visual Basic 6 and Earlier >  [RESOLVED] Shel Explorer, select more than one file ?

## Couin

Hi friends, 

First, I wish you an happy new year  :Smilie:  

I actually use this to open Windows files explorer and select a file (created by the app) to reveal it :

```
Shell "explorer.exe /select, " & MyFilepath, vbNormalFocus
```

As well as I changed some code, the ouput can create more than 1 file, so I would get these multiple files selected on explorer opening. 

Of course, 

```
Shell "explorer.exe /select, " & MyFilepath1, MyFilepath2, MyFilepath3, vbNormalFocus
```

does not run  :Embarrassment: 

Is it (noit too complicated) feasable ?

Thanks  :Smilie: 
 :Duck:

----------


## fafalone

Can't do it with shell/shellexecute... To select multiple items you have to use the SHOpenFolderAndSelectItems API:

[VB6] Code Snippet: Open a folder and select multiple files in Explorer

----------


## Couin

Hi fafalone  :Smilie: 

Thanks for answer. I already saw this thread during my research but if I understood well, it selects (all) files of a folder ?  
Also, I didn't unterstand how to use ?  :Blush:

----------


## fafalone

You pass it an array of files, and it opens their folders and selects them.



```
Dim sFiles() As String
ReDim sFiles(2)
sFiles(0) = "C:\folder\file1.txt"
sFiles(1) = "C:\folder\file2.txt"
sFiles(2) = "C:\folder\file3.txt"

OpenFolders sFiles
```

will open C:\folder and select file1.txt, file2.txt, and file3.txt. I agree it could be better named, but the name and a lot of the complexity comes from the fact it also supports files in multiple folders, i.e.



```
Dim sFiles() As String
ReDim sFiles(3)
sFiles(0) = "C:\folder1\file1.txt"
sFiles(1) = "C:\folder1\file2.txt"
sFiles(2) = "C:\folder2\file3.txt"
sFiles(3) = "C:\folder2\file4.txt"

OpenFolders sFiles
```

That will open both folder1 and folder2, and select file1.txt+file2.txt in folder1, and file3.txt+file4.txt in folder2.


PS- For fun, I also have a demo of how to be on the other side of this API... to tell the system your app is displaying C:\folder, and receive the message to select the files. 
[VB6] Using IShellWindows to register for SHOpenFolderAndSelectItems

----------


## Couin

Hi, 

thanks for tip, looks running as attempted, thanks a lot  :Thumb: 

 :Duck:

----------

