Private Sub BtnClic_Click()
'
On Error Resume Next
If Dir(Fichier) <> "" And Fichier <> "" Then
If Right(Fichier, 1) = "\" Then
Dim fd As Office.FileDialog
Dim strFichier As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Filters.Clear
.Filters.Add "Fichier", "*.*", 1
.Title = "Choisissez un fichier"
.AllowMultiSelect = False
.InitialFileName = Fichier
If .Show = True Then
strFichier = .SelectedItems(1)
If strFichier = "" Then Exit Sub
Fichier = strFichier
End If
End With
End If
If Right(Fichier, 3) = "xls" Or Right(Fichier, 4) = "xlsm" Or Right(Fichier, 4) = "xlsx" Then
Dim xl As Object
Set xl = CreateObject("Excel.Application")
xl.Workbooks.Open Filename:=Fichier
xl.Visible = True
Set xl = Nothing
Exit Sub
End If
If Fichier Like "*http*" Then
ActiveWorkbook.FollowHyperlink Fichier
Else
Dim MonApplication As Object
Set MonApplication = CreateObject("Shell.Application")
MonApplication.Open Fichier
Set MonApplication = Nothing
End If
End If
End Sub