Copy Range from Excel to Word Document

HotNumbers

Well-known Member
Joined
Feb 14, 2005
Messages
732
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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:
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

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
Back
Top