Boostez vos compétences Excel avec notre communauté !
Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !
MkDir RepertoireRacine & "\" & Dossiers_Complets & "\" & Dossier_Indiv
Dossier_Indiv = "IDEleve" & "NomEleve" & "PrenomEleve" & "\"
Dossier_Indiv = IDEleve & NomEleve & PrenomEleve
Sub Création_Dossiers()
Dim Nom_de_Dossier As String
IDEleve = "325"
NomEleve = "Durant"
PrenomEleve = "Louis"
Nom_de_Dossier = IDEleve & "_" & NomEleve & "_" & PrenomEleve
If Dir(ThisWorkbook.Path & "\" & Nom_de_Dossier, vbDirectory) = "" Then _
MkDir ThisWorkbook.Path & "\" & Nom_de_Dossier
End Sub
Public IDEleve As String, NomEleve As String, PrenomEleve As String, Corbeille As IntegerPublic RepertoireRacine As String
Public Dossiers_Complets As String
Public LigneDepartUnique As Integer
Public Nom_de_Dossier As String
Public BD_Eleves As String, Renseignements_élève As String
Sub Création_Dossiers()
Dim Nom_de_Dossier As String
Dim LigneCourante As Double
IDE = IDEleve
Nme = NomEleve
Pre = PrenomEleve
Nom_de_Dossier = IDE & "_" & Nme & "_" & Pre
Dossiers_Complets = "Dossiers_Complets_AFP\"
If Dir(ThisWorkbook.Path & "\" & Dossiers_Complets & "\" & Nom_de_Dossier, vbDirectory) = "" Then _
MkDir ThisWorkbook.Path & "\" & Nom_de_Dossier
End Sub
Sub CreationFichierUnique()
Dim a As String
Err = 0
On Error Resume Next
a = Sheets(2).Cells(6, 6)
If Err <> 0 Then
Exit Sub
End If
Application.ScreenUpdating = False
Set trouve = Sheets("BD_Eleves").Columns("B:B").Find(What:=Sheets(1).Cells(6, 4), LookIn:=xlValues, _
LookAt:=xlPart, MatchCase:=False, SearchFormat:=False)
If Not trouve Is Nothing Then LigneDepartUnique = trouve.Row
Call CreationFichier
LigneDepartUnique = 0
Application.ScreenUpdating = True
Exit Sub
End Sub
Sub CreationFichier()
Dim LigneDepart As Double
Dim LigneCourante As Double
Dim Dossier_Indiv As Variant
Dossiers_Complets = "Dossiers_Complets_AFP\"
Application.ScreenUpdating = False
Sheets("BD_Eleves").Select
RepertoireRacine = ThisWorkbook.Path & "\"
If LigneDepartUnique <> 0 Then
LigneDepart = LigneDepartUnique
Else
LigneDepart = 3
End If
LigneCourante = LigneDepart
Do Until Cells(LigneCourante, 2) = ""
'Variable à mémoriser
IDEleve = Cells(LigneCourante, 2)
DebutFormation = Cells(LigneCourante, 4)
NomEleve = Cells(LigneCourante, 5)
PrenomEleve = Cells(LigneCourante, 6)
DateNaissance = Cells(LigneCourante, 7)
AdressePrivee = Cells(LigneCourante, 8)
TelephonePrive = Cells(LigneCourante, 9)
TelelephonePortable = Cells(LigneCourante, 10)
EntrepriseFormatrice = Cells(LigneCourante, 11)
NomPrenomChef = Cells(LigneCourante, 12)
AdresseEmployeur = Cells(LigneCourante, 13)
TelephoneEmployeur = Cells(LigneCourante, 14)
AdresseMailFormateur = Cells(LigneCourante, 15)
AdresseMailEEL = Cells(LigneCourante, 16)
UsernameEEL = Cells(LigneCourante, 17)
PasswordEEL = Cells(LigneCourante, 18)
UsernameEdmodo = Cells(LigneCourante, 19)
PasswordEdmodo = Cells(LigneCourante, 20)
UsernameWigl = Cells(LigneCourante, 21)
PasswordWigl = Cells(LigneCourante, 22)
UsernameDropbox = Cells(LigneCourante, 23)
PasswordDropbox = Cells(LigneCourante, 24)
CollSupp1 = Cells(LigneCourante, 25)
CollSupp2 = Cells(LigneCourante, 26)
'============================
'Ouverture du fichier de base à copier
'============================
Application.DisplayAlerts = False
Workbooks.Open Filename:=RepertoireRacine & "BBBB_Base_élève_AFP.xlsm", ReadOnly:=True
Call Protection(False)
'============================
'Ecriture de variables mémorisées
'============================
Sheets("Renseignements_élève").Range("B3").Value = IDEleve
Sheets("Renseignements_élève").Range("D3").Value = DebutFormation
Sheets("Renseignements_élève").Range("B6").Value = NomEleve
Sheets("Renseignements_élève").Range("D6").Value = PrenomEleve
Sheets("Renseignements_élève").Range("B8").Value = DateNaissance
Sheets("Renseignements_élève").Range("B10").Value = AdressePrivee
Sheets("Renseignements_élève").Range("B12").Value = TelephonePrive
Sheets("Renseignements_élève").Range("D12").Value = TelelephonePortable
Sheets("Renseignements_élève").Range("B15").Value = EntrepriseFormatrice
Sheets("Renseignements_élève").Range("B17").Value = AdresseEmployeur
Sheets("Renseignements_élève").Range("B19").Value = TelephoneEmployeur
Sheets("Renseignements_élève").Range("D15").Value = NomPrenomChef
Sheets("Renseignements_élève").Range("D19").Value = AdresseMailFormateur
Sheets("Renseignements_élève").Range("B22").Value = AdresseMailEEL
Sheets("Renseignements_élève").Range("B24").Value = UsernameEEL
Sheets("Renseignements_élève").Range("D24").Value = PasswordEEL
Sheets("Renseignements_élève").Range("B26").Value = UsernameEdmodo
Sheets("Renseignements_élève").Range("D26").Value = PasswordEdmodo
Sheets("Renseignements_élève").Range("B28").Value = UsernameWigl
Sheets("Renseignements_élève").Range("D28").Value = PasswordWigl
Sheets("Renseignements_élève").Range("B30").Value = UsernameDropbox
Sheets("Renseignements_élève").Range("D30").Value = PasswordDropbox
Sheets("Renseignements_élève").Range("B32").Value = CollSupp1
Sheets("Renseignements_élève").Range("D32").Value = CollSupp2
'Sauvegarde et ferme le document dans le répertoire consacré
Sheets("Renseignements_élève").Select
Application.DisplayAlerts = True
Call Protection(True)
'Création du dossier individuel
Call Création_Dossiers
ActiveWorkbook.SaveAs _
Filename:=RepertoireRacine & Dossiers_Complets & Nom_de_Dossier & IDEleve & " " & NomEleve & " " & PrenomEleve & ".xlsm"
ActiveWindow.Close
If LigneDepartUnique <> 0 Then
Exit Do
Else
LigneCourante = LigneCourante + 1
End If
Loop ' Crée la boucle sur l'Eleve suivant
Application.ScreenUpdating = True
End Sub
Sub CreationFichierUnique()
Dim a As String
'à quoi servent les 6 lignes qui suivent?
Err = 0
On Error Resume Next
a = Sheets(2).Cells(6, 6)
If Err <> 0 Then
Exit Sub
End If
'Application.ScreenUpdating = False
Set trouve = Sheets("BD_Eleves").Columns("B:B").Find(What:=Sheets(1).Cells(6, 4), LookIn:=xlValues, _
LookAt:=xlPart, MatchCase:=False, SearchFormat:=False)
If Not trouve Is Nothing Then LigneDepartUnique = trouve.Row
Call CreationFichier 'quid si trouve=Nothing ?
LigneDepartUnique = 0
'Application.ScreenUpdating = True
Exit Sub
End Sub
Sub CreationFichier()
Dim LigneDepart As Double
Dim LigneCourante As Double
Dim Dossier_Indiv As Variant
Dossiers_Complets = "Dossiers_Complets_AFP\"
Application.ScreenUpdating = False
Sheets("BD_Eleves").Select
RepertoireRacine = ThisWorkbook.Path & "\"
If LigneDepartUnique <> 0 Then
LigneDepart = LigneDepartUnique
Else
LigneDepart = 3
End If
LigneCourante = LigneDepart
Do Until Cells(LigneCourante, 2) = ""
'Variable à mémoriser
IDEleve = Cells(LigneCourante, 2)
DebutFormation = Cells(LigneCourante, 4)
NomEleve = Cells(LigneCourante, 5)
PrenomEleve = Cells(LigneCourante, 6)
DateNaissance = Cells(LigneCourante, 7)
AdressePrivee = Cells(LigneCourante, 8)
TelephonePrive = Cells(LigneCourante, 9)
TelelephonePortable = Cells(LigneCourante, 10)
EntrepriseFormatrice = Cells(LigneCourante, 11)
NomPrenomChef = Cells(LigneCourante, 12)
AdresseEmployeur = Cells(LigneCourante, 13)
TelephoneEmployeur = Cells(LigneCourante, 14)
AdresseMailFormateur = Cells(LigneCourante, 15)
AdresseMailEEL = Cells(LigneCourante, 16)
UsernameEEL = Cells(LigneCourante, 17)
PasswordEEL = Cells(LigneCourante, 18)
UsernameEdmodo = Cells(LigneCourante, 19)
PasswordEdmodo = Cells(LigneCourante, 20)
UsernameWigl = Cells(LigneCourante, 21)
PasswordWigl = Cells(LigneCourante, 22)
UsernameDropbox = Cells(LigneCourante, 23)
PasswordDropbox = Cells(LigneCourante, 24)
CollSupp1 = Cells(LigneCourante, 25)
CollSupp2 = Cells(LigneCourante, 26)
'============================
'Ouverture du fichier canevas
'============================
Application.DisplayAlerts = False
Workbooks.Open Filename:=RepertoireRacine & "BBBB_Base_élève_AFP.xlsm", ReadOnly:=True
Call Protection(False)
'============================
'Ecriture de variables mémorisées
'============================
Sheets("Renseignements_élève").Range("B3").Value = IDEleve
Sheets("Renseignements_élève").Range("D3").Value = DebutFormation
Sheets("Renseignements_élève").Range("B6").Value = NomEleve
Sheets("Renseignements_élève").Range("D6").Value = PrenomEleve
Sheets("Renseignements_élève").Range("B8").Value = DateNaissance
Sheets("Renseignements_élève").Range("B10").Value = AdressePrivee
Sheets("Renseignements_élève").Range("B12").Value = TelephonePrive
Sheets("Renseignements_élève").Range("D12").Value = TelelephonePortable
Sheets("Renseignements_élève").Range("B15").Value = EntrepriseFormatrice
Sheets("Renseignements_élève").Range("B17").Value = AdresseEmployeur
Sheets("Renseignements_élève").Range("B19").Value = TelephoneEmployeur
Sheets("Renseignements_élève").Range("D15").Value = NomPrenomChef
Sheets("Renseignements_élève").Range("D19").Value = AdresseMailFormateur
Sheets("Renseignements_élève").Range("B22").Value = AdresseMailEEL
Sheets("Renseignements_élève").Range("B24").Value = UsernameEEL
Sheets("Renseignements_élève").Range("D24").Value = PasswordEEL
Sheets("Renseignements_élève").Range("B26").Value = UsernameEdmodo
Sheets("Renseignements_élève").Range("D26").Value = PasswordEdmodo
Sheets("Renseignements_élève").Range("B28").Value = UsernameWigl
Sheets("Renseignements_élève").Range("D28").Value = PasswordWigl
Sheets("Renseignements_élève").Range("B30").Value = UsernameDropbox
Sheets("Renseignements_élève").Range("D30").Value = PasswordDropbox
Sheets("Renseignements_élève").Range("B32").Value = CollSupp1
Sheets("Renseignements_élève").Range("D32").Value = CollSupp2
'Sauvegarde et ferme le document dans le repertoire consacré
Sheets("Renseignements_élève").Select
Application.DisplayAlerts = True
Call Protection(True)
'Création du dossier individuel
Dossier_Indiv = IDEleve & NomEleve & PrenomEleve
MkDir RepertoireRacine & "\" & Dossiers_Complets & Dossier_Indiv
test = 22
ActiveWorkbook.SaveAs _
Filename:=RepertoireRacine & Dossiers_Complets & Dossier_Indiv & "\" & IDEleve & " " & NomEleve & " " & PrenomEleve & ".xlsm"
ActiveWindow.Close
If LigneDepartUnique <> 0 Then
Exit Do
Else
LigneCourante = LigneCourante + 1
End If
Loop ' passe au Eleve suivant
Application.ScreenUpdating = True
End Sub
?test = 22
Mon pauvre ami ... j'ai bien peur que ceci n'apporte rien à ta culture 🙁Ceci me permettra de me coucher avec un peu de culture 😛
J'ai cherché. retourné, mais là, je sèche... une fois de plus.Set trouve = Sheets("BD_Eleves").Columns("B:B").Find(What:=Sheets(1).Cells(6, 4), LookIn:=xlValues, _
LookAt:=xlPart, MatchCase:=False, SearchFormat:=False)
Si tu évoques une nouvelle version ... serait-il déraisonnable de penser que ladite version aurait dû se trouver en pièce jointe? Solution qui paraîtrait judicieuse, puisque je suppute que tu auras apporté de petites modifs de droite et de gauche ... Il ne faudrait pas que nous travaillions sur des versions trop différentes!ma macro Sub CreationFichierUnique() ne fonctionne plus avec cette version
We use cookies and similar technologies for the following purposes:
Est ce que vous acceptez les cookies et ces technologies?
We use cookies and similar technologies for the following purposes:
Est ce que vous acceptez les cookies et ces technologies?