Private Sub CommandButton1_Click() 'bouton PDF
Dim dossier As FileDialog, chemin$, fichier$, F As Worksheet, n%
ChDir ThisWorkbook.Path & "\"
Set dossier = Application.FileDialog(msoFileDialogFolderPicker)
If dossier.Show = False Then Exit Sub 'Annuler
chemin = dossier.SelectedItems(1) & "\"
fichier = Dir(chemin & "*.pdf")
Set F = Sheets("Liste")
F.[A:B].ClearContents 'RAZ
While fichier <> ""
n = n + 1
F.Cells(n, 1) = fichier
F.Cells(n, 2) = chemin & fichier
fichier = Dir
Wend
With [C3]
.Validation.Delete 'RAZ
.ClearContents 'RAZ
If n Then .Validation.Add xlValidateList, Formula1:="=" & F.[A1].Resize(n).Address(External:=True)
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
With [C3]
If Intersect(Target, .Cells) Is Nothing Then Exit Sub
If .Value = "" Then .Offset(, 1).Clear: Exit Sub
CreateObject("wscript.shell").SendKeys "{TAB}~" 'évite le message
ThisWorkbook.FollowHyperlink Application.VLookup(.Value, Sheets("Liste").[A:B], 2, 0)
End With
End Sub