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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| Private Sub CommandButton4_Click()
Dim xlApp As New Excel.Application
Dim NonFichierImport1
Dim vChemin
Dim a, b, y, x
' Boite de dialogue Ouvrir un fichier
With Application.FileDialog(msoFileDialogOpen)
.Filters.Add "Fichiers ", "*.xls*", 1
FichierAOuvrir = .Show
End With
If FichierAOuvrir <> 0 Then
FichierAOuvrir = Application.FileDialog(msoFileDialogOpen).SelectedItems(1)
' MsgBox FichierAOuvrir
Else
MsgBox "Aucun fichier sélectionné, fin de programme !", vbCritical
End If
Label6 = "Code Raf: " & Workbooks("fichier_liste").Sheets("Liste Agent").Cells(2, 10)
Label7 = "Code Sessions: " & Workbooks("fichier_liste").Sheets("Liste Agent").Cells(2, 12)
For a = 2 To 20
If Workbooks("fichier_liste").Sheets("Liste Agent").Cells(a, 21) = "" Then GoTo suite1
NCP.AddItem Workbooks("fichier_liste").Sheets("Liste Agent").Cells(a, 21)
Next a
suite1:
'NonFichierImport1 = ActiveWorkbook.Name & ".xlsx"
vChemin = ActiveWorkbook.Path
'Application.Dialogs(xlDialogSaveAs).Show
'ActiveWorkbook.SaveAs FileName:= _
vChemin & "\" & NonFichierImport1, _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
NonFichierImport1 = ActiveWorkbook.Name
End Sub
Private Sub NCP_Change()
For a = 2 To 20
If Workbooks("fichier_liste").Sheets("Liste Agent").Cells(a, 21) = "" Then GoTo fin
If Workbooks("fichier_liste").Sheets("Liste Agent").Cells(a, 21) = NCP Then Nom = Workbooks("fichier_liste").Sheets("Liste Agent").Cells(a, 18): _
Prenom = Workbooks("fichier_liste").Sheets("Liste Agent").Cells(a, 19)
Next a
fin:
End Sub |
Partager