Sub miseajour()
'
' miseajour Macro
'gestion -ses-historique des formations
Worksheets("- Ses - Historique des formatio").Select
Cells.Clear
'est il possible d'activer un fichier.cvs dont on ne connais ni le nom , ni l'adresse
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Title = "Recherche du fichier Csv"
.InitialFileName = ThisWorkbook.Path & "\*.csv"
.Filters.Clear: .Filters.Add "Bla bla Csv", "*.csv"
If .Show Then
Dim Wb As Workbook, F As Variant
On Error Resume Next
F = Split(.SelectedItems(1), Application.PathSeparator)
Set Wb = Application.Workbooks(F(UBound(F)))
If Not Wb Is Nothing Then ' option 1 si il est ouvert
Wb.Activate
Else ' option 2 pas ouvert
Workbooks.Open Filename:=.SelectedItems(1), ReadOnly:=True, local:=True
End If
Columns("A").Copy Destination:=ThisWorkbook.ActiveSheet.Columns("A")
ActiveWorkbook.Close savechanges:=False
End If
End With
ThisWorkbook.Activate
[E1].FormulaR1C1 = "=""Merci beaucoupe de votre aide"""
End Sub