Text Functions‎ > ‎

Excel to Word

PROBLEM:

"I have a Word document with a bookmark in it called INPUTS. I'd like to copy the data from my Excel worksheet called INPUTS, a specific range of cells, into the Word document for me placed at that bookmark."

SPECIFICATIONS:
  1. The MS Word document with the range is open and the active document
  2. The MS Excel document is open

CODE

Option Explicit

Sub CopyExcelRangeToWordBookmark()
' Jerry Beaucaire,  10/17/2011
' Set a reference to Microsoft Word ?? Object Library
Dim WDApp As Word.Application
Dim WDDoc As Word.Document

Set WDApp = GetObject(, "Word.Application")
Set WDDoc = WDApp.ActiveDocument

    Sheets("Inputs").Range("A11:B30").Copy
    WDDoc.Bookmarks.Item("Inputs").Range.Paste

Set WDApp = Nothing
Set WDDoc = Nothing
End Sub


Comments