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 33 34 35
| Sub MAJPLANNING()
Application.ScreenUpdating = False
Dim fichier As FileDialog
Dim chaine As String
Set fichier = Application.FileDialog(msoFileDialogFilePicker)
fichier.Show
'MsgBox fichier.InitialFileName ' affiche le repertoire du fichier selectionné uniquement
'MsgBox fichier.SelectedItems(1) 'affiche le repertoire complet
chaine = fichier.SelectedItems(1)
chaine = Right(chaine, InStr(1, StrReverse(chaine), "\") - 1)
'MsgBox chaine 'msgbox qui premet de recuperer uniquement le nom du fichier selectionné ex : toto.xls
Worksheets("ACCUEIL").Unprotect Password:="djou"
Worksheets("CODE HORAIRE").Unprotect Password:="djou"
Worksheets("PLANNING").Unprotect Password:="djou"
Worksheets("GXP").Unprotect Password:="djou"
Sheets("ACCUEIL").Range("c16").Value = chaine
Sheets("ACCUEIL").Range("c20").Value = fichier.InitialFileName
MAJPLCH
Worksheets("ACCUEIL").Protect Password:="djou"
Worksheets("CODE HORAIRE").Protect Password:="djou"
Worksheets("PLANNING").Protect Password:="djou"
Worksheets("GXP").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, Password:="djou"
perso.Show
Application.ScreenUpdating = True
End Sub |