VBA & Macro Problems

Copy Excel Ranges to Word with VBA Section Breaks

Elise WilliamsElise Williams Nov 20, 2026 869 views

Question details

Copy multiple Excel cell ranges into a Word document and insert a section break after each pasted range using VBA.

Copy Excel Ranges to Word with VBA Section Breaks
Product
Microsoft Excel and Microsoft Word VBA
Device & OS
not provided
Scenario
An Excel VBA macro needs to build a Word document from several worksheet ranges, with each range followed by a next-page section break.
Observed behavior
The desired document contains the pasted Excel ranges separated by Word section breaks. Assigning an Excel range directly to a Word Range variable can cause a type mismatch.
Before you start

Open the Excel workbook containing the source ranges and confirm the worksheet name and cell addresses. In the VBA editor, enable the Microsoft Word Object Library under Tools > References for the early-bound example below.

Solution 1Recommended

Paste each Excel range using a Word Range object

Use this Excel VBA macro to create a Word document, paste each specified cell range, and add a next-page section break.

Excel.Range and Word.Range belong to different object models. Copy the Excel cells to the clipboard, then use a Word.Range as the insertion point rather than assigning the Excel range to it.

1
Open the VBA editor

In Excel, press Alt+F11, select your workbook's VBA project, and choose Insert > Module.

2
Add the Word reference

In the VBA editor, choose Tools > References, select Microsoft Word Object Library, and click OK.

3
Enter and adapt the macro

Paste the following code into the module. Replace Sheet1 and the addresses in Array with your worksheet name and ranges: Sub CopyRangesToWord() Dim wdApp As Word.Application Dim wdDoc As Word.Document Dim wordRange As Word.Range Dim ws As Excel.Worksheet Dim address As Variant Set ws = ActiveWorkbook.Worksheets("Sheet1") Set wdApp = New Word.Application wdApp.Visible = True Set wdDoc = wdApp.Documents.Add For Each address In Array("A1:C5", "E1:G5") ws.Range(CStr(address)).Copy Set wordRange = wdDoc.Range wordRange.Collapse Direction:=wdCollapseEnd wordRange.Paste Set wordRange = wdDoc.Range wordRange.Collapse Direction:=wdCollapseEnd wordRange.InsertBreak Type:=wdSectionBreakNextPage Next address Application.CutCopyMode = False End Sub

4
Run and check the document

Place the cursor inside CopyRangesToWord and press F5. In Word, inspect the pasted ranges and section breaks, then use File > Save As to save the document.

Paste each Excel range using a Word Range object
Final section break: The macro inserts a break after every range, including the last one. Omit the final break if you do not need a new section after the last paste.
Free Microsoft Office alternative

Work with Excel and Word files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with spreadsheets and documents. Open existing Office files to make a straightforward transition; the Microsoft Word automation macro above is specific to Microsoft Office.

Work with spreadsheet ranges and documents in one office suiteCompatible with Microsoft Excel XLSX and Word DOCX formatsFamiliar spreadsheet and document editing interfaceFree, lightweight option for everyday Office-file editing
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a type mismatch when assigning a range?

An Excel cell range and a Word document range are different object types. Declare the insertion point as Word.Range, set it from wdDoc.Range, and copy the Excel range before calling wordRange.Paste.

Why does the macro reset the Word range after pasting?

Pasting can change the range position. Setting wordRange to wdDoc.Range again and collapsing it with wdCollapseEnd places the insertion point at the document end before InsertBreak runs.

How can I use different worksheet ranges?

Edit the addresses in Array("A1:C5", "E1:G5") and change Worksheets("Sheet1") to the name of the sheet containing your data.

What does wdSectionBreakNextPage do?

It inserts a Word section break that starts the next section on a new page. The example applies it after each pasted range, including the last one.