1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Option Explicit
Dim XL As New Excel.Application
Private Sub CommandButton1_Click()
Dim szPath As String
szPath = ActiveWorkbook.Path
CurDir (szPath)
Call UseFileDialogOpen
'FileToOpen = XL.GetOpenFilename(filefilter:="Classeurs Excel,*.xls;*.xlsx", Title:="Choissisez les classeurs a fusionner", MultiSelect:=False)
'TextBox1 = FileToOpen
End Sub
Sub UseFileDialogOpen()
' Ce code se trouve dans l'aide Excel
Dim lngCount As Long
' Open the file dialog
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = True
.Show
' Display paths of each file selected
For lngCount = 1 To .SelectedItems.Count
MsgBox .SelectedItems(lngCount)
Next lngCount
End With
End Sub |
Partager