joanie1234
11-15-2017, 12:37 PM
Hi,
I have a 2-page form to which I made a mail merge. (You'll find a example in attachment)
I would like to save it in Word individually, but I really have a problem with the code (and I'm more or less talented in this field)
1- The layout does not follow correctly
Here the code for now:
Sub BreakOnPage()
Application.Browser.Target = wdBrowseSection
For i = 1 To ActiveDocument.BuiltInDocumentProperties("Number of Pages")
Dim mon_modele As String
mon_modele = ActiveDocument.AttachedTemplate.FullName
ActiveDocument.Bookmarks("\page").Range.Copy
Documents.Add Template:=mon_modele
Selection.PasteAndFormat (wdFormatOriginalFormatting)
Selection.PageSetup.Orientation = wdOrientLandscape
Selection.TypeBackspace
ChangeFileOpenDirectory "P:\ÉVÉNEMENTS SIGNATURES\2. Mois de la jonquille\Jonquilles 2018\4. Points de vente\Formulaire\Nouveau dossier\TEST"
DocNum = DocNum + 1
ActiveDocument.SaveAs FileName:="Formulaire jonquille_" & DocNum & ".docx"
ActiveDocument.Close
Application.Browser.Next
Next i
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub
Can someone help me with this?
Thank you so much! 2096420964
I have a 2-page form to which I made a mail merge. (You'll find a example in attachment)
I would like to save it in Word individually, but I really have a problem with the code (and I'm more or less talented in this field)
1- The layout does not follow correctly
Here the code for now:
Sub BreakOnPage()
Application.Browser.Target = wdBrowseSection
For i = 1 To ActiveDocument.BuiltInDocumentProperties("Number of Pages")
Dim mon_modele As String
mon_modele = ActiveDocument.AttachedTemplate.FullName
ActiveDocument.Bookmarks("\page").Range.Copy
Documents.Add Template:=mon_modele
Selection.PasteAndFormat (wdFormatOriginalFormatting)
Selection.PageSetup.Orientation = wdOrientLandscape
Selection.TypeBackspace
ChangeFileOpenDirectory "P:\ÉVÉNEMENTS SIGNATURES\2. Mois de la jonquille\Jonquilles 2018\4. Points de vente\Formulaire\Nouveau dossier\TEST"
DocNum = DocNum + 1
ActiveDocument.SaveAs FileName:="Formulaire jonquille_" & DocNum & ".docx"
ActiveDocument.Close
Application.Browser.Next
Next i
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub
Can someone help me with this?
Thank you so much! 2096420964