Bonjour,
J'essai toujours de séparer les différents fichier d'un publipostage mais le code que j'ai repris ne fonctionne pas et je ne comprend pas pourquoi...
Merci d'avance
Sub Couper_sections()
Application.ScreenUpdating = False
Dim SousDoc As Document
Dim chemin As String
Dim R As Range
Dim x, DocNum
For x = 1 To ActiveDocument.Sections.Count - 1
Set R = ActiveDocument.Sections(x).Range: R.End = R.End - 1
R.Copy
'Mettez le chemin complet et le nom du modèle
Documents.Add Template:="C:\Users\9820190V\OneDrive - SNCF\ARBRE DANGEREUX\Publipostage courrier"
Selection.Paste
DocNum = DocNum + 1
'Mettez ici le nom complet du dossier où vous souhaitez récupérer les documents
chemin = "C:\Users\9820190V\OneDrive - SNCF\ARBRE DANGEREUX\Publipostage courrier"
With ActiveDocument
.SaveAs Filename:=chemin & DocNum & ".docx"
.Close
End With
Next x
Set SousDoc = Nothing
Set R = Nothing
Application.ScreenUpdating = True
End Sub