Private Sub CommandButton1_Click()
Dim wbSource, wbFichierUsager As Workbook
Dim strFileName As String, chemin As String
Dim intChoice As Integer 'Déclarer les variables de base
Dim nl As Integer
Set wbFichierUsager = ThisWorkbook
' On va appeler une application de MS Office afin de chercher et d’ouvrir le bon fichier
' Avec la commande qui suit, on indique que nous ne voulons qu’un seul fichier
Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
' On affiche l’écran de dialogue de MS Office
Application.FileDialog(msoFileDialogOpen).InitialFileName = "C:\chemin du fihier\"
intChoice = Application.FileDialog(msoFileDialogOpen).Show
' On s’assure que l’usager a fait un choix
If intChoice <> 0 Then
' On récupère le nom complet du fichier
strFileName = Application.FileDialog(msoFileDialogOpen).SelectedItems(1)
Workbooks.Open strFileName
' Sinon, on arrête tout en notifiant l’usager
Else
' S’il n’y a pas de fichier, on quitte sans rien faire
MsgBox "La procédure est annulée car aucun fichier n’a été entré."
Exit Sub
End If