In this article, we will focus on showing you 3 ways to quickly insert section breaks into your Word document.
Section breaks are useful as to divide a document into sections, chapters, etc. Besides, to insert section breaks is an indispensable part of setting different headers or footers on different pages.
Normally, we will have to navigate to the page and locate cursor at proper position. Next click “Page Layout” and “Breaks”. And then choose a section break type on the drop-down menu. Such a proceeding can be tedious sometimes. Therefore, we want to save you from the usual routine and adopt a quick-and-dirty solution.
Method 1: Insert a Section Break on a Specific Page
- First of all, press “Alt+ F11” in Word to invoke the VBA editor.
- Next create a new module by clicking “Normal” in the left column.
- Then click “Insert” tab on the menu bar.
- And choose “Module” on the drop-down menu of “Insert”.
- Double click on new module as to open it.
- Paste the following macro on the coding area:
Sub InsertBreakOnSpecificPage() Dim strPageNum As String Dim nPageNum As Integer strPageNum = InputBox("Enter a page number: ") nPageNum = Int(strPageNum) Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=nPageNum ActiveDocument.Bookmarks("\page").Range.Select Selection.Collapse wdCollapseEnd Selection.InsertBreak Type:=wdSectionBreakContinuous End Sub
- Now, click “Run” or hit “F5” to execute codes.
- Next enter a page number of the target page in the prompting box. And click “OK” to proceed.
So far, you’ve inserted a section break at the end of page 2.
If you want to separate several consecutive pages as a section with the use of section breaks, you need to insert section break twice, one at the end of the last page of previous section and one at the end of the last page of this new section.
In such a case, while inserting the first break, you ought to remember entering the correct number that is the page number of the last page of previous section.
Method 2: Insert a Section Break on Each Page of a Document
- Firstly, install and run a macro following above steps exactly.
- Then replace the macro with this one:
Sub InsertBreakOnEachPage() Dim nTotalPageNumber As Integer For nTotalPageNumber = 1 To Selection.Information(wdNumberOfPagesInDocument) Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=nTotalPageNumber Application.Browser.Target = wdBrowsePage ActiveDocument.Bookmarks("\page").Range.Select Selection.Collapse wdCollapseEnd Selection.InsertBreak Type:=wdSectionBreakContinuous Next End Sub
This macro inserts a section break at the end of each page of current document.
Method 3: Insert a Section Break on Each Page of Multiple Documents
- To begin with, put all target documents in the same folder.
- Then similarly, install and run macro with proper instructions.
- This time, use these codes:
Sub InsertBreaksIntoMultiDoc() Dim StrFolder As String Dim strFile As String Dim objDoc As Document Dim dlgFile As FileDialog Dim nTotalPageNumber As Integer Set dlgFile = Application.FileDialog(msoFileDialogFolderPicker) With dlgFile If .Show = -1 Then StrFolder = .SelectedItems(1) & "\" Else MsgBox "No folder is selected! Please select the target folder." Exit Sub End If End With strFile = Dir(StrFolder & "*.docx", vbNormal) While strFile <> "" Set objDoc = Documents.Open(FileName:=StrFolder & strFile) For nTotalPageNumber = 1 To Selection.Information(wdNumberOfPagesInDocument) Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=nTotalPageNumber Application.Browser.Target = wdBrowsePage ActiveDocument.Bookmarks("\page").Range.Select Selection.Collapse wdCollapseEnd Selection.InsertBreak Type:=wdSectionBreakContinuous Next objDoc.Save objDoc.Close strFile = Dir() Wend End Sub
- The macro shall trigger the “Browse” window. Pick the folder where you keep documents and click “OK”.
The process shall take no more than a few seconds.
Handy Tool for Document Corruption
It’s a frustrating experience to encounter with damaged documents. In such scenario, a good and reliable tool that can help repair Word documents shall be able to relieve one’s anxiety a lot. Therefore, you need to be extremely cautious while choosing a repairing tool. An insufficient utility may cause further damage.
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including Excel recovery and pdf repair software products. For more information visit www.datanumen.com