Copy Range from Excel to Word Document

HotNumbers

Well-known Member
Joined
Feb 14, 2005
Messages
728
I am stuck on how i can copy a range from excel into a word template to a specific line location in a 3 page word document.

1. I have create an excel workbook with Word Document path already Identified.
2. I have also identified a path the document needs to be save as
3. User enters in a cell what the new Word doc file name will be.

My Issue is.
How do I copy a range from Excel into the Word document into a specific location?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

HaHoBe

Active Member
Joined
Jan 24, 2003
Messages
485
Office Version
  1. 2013
Platform
  1. Windows
Hi HotNumbers,

have you considered to add a Bookmark to your word doc and fill that Bookmark with the contents? Code may look like this:
Code:
Sub FillWdBookmarkFromExcel()
'https://www.mrexcel.com/board/threads/copy-range-from-excel-to-word-document.1169696/
 
  Dim objWord             As Object
  Dim objDoc              As Object
  Dim blnWdCreated        As Boolean

  On Error Resume Next
  Set objWord = GetObject(Class:="Word.Application")
 
  If Err.Number > 0 Then
    Err.Clear
    Set objWord = CreateObject(Class:="Word.Application")
    blnWdCreated = True
  End If
 
  On Error GoTo 0
 
  With objWord
    .Application.Visible = True
    Set objDoc = .Documents.Open("C:\MyPlace}Word\YourWordDocument.docx")
    With objDoc
      .Range(.Bookmarks("MyBookmark").Range.Start, _
              .Bookmarks("MyBookmark").Range.End).Text = ActiveSheet.Range("B45").Value
      .SaveAs "YourDrive&Path\" & "YourName.docx"
      .Close
    End With
    Set objDoc = Nothing
  End With
 
  If blnWdCreated Then objWord.Quit
  Set objWord = Nothing

End Sub
Please adjust the name of the bookmark and fill in the required information for path, folder and name of the document to save.

Ciao,
Holger
 
Last edited:

Forum statistics

Threads
1,140,925
Messages
5,703,203
Members
421,280
Latest member
Jaycee01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top