View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
statum statum is offline
external usenet poster
 
Posts: 26
Default Import Excel 2003 data into Word 2003

Hello all, I am trying to write a macro in a Word 2003 document that will
allow the user to import some data from an Excel 2003 spreadsheet. I got
started with trying to "MailMerge" using the code below but all it does is
open a BLANK, new word document and it does not import anything from the
Excel sheet. Any ideas? Is MailMerge the wrong direction to go with this?
Thanks in advace for the help.

Sub ImportDatafromExcelintoWord()

Dim docNew As Document

Set docNew = Documents.Add

With docNew.MailMerge
.MainDocumentType = wdNotAMergeDocument
.OpenDataSource Name:="C:\Data\ExcelImportData.xls", _
ReadOnly:=True, _
Connection:="CustomerData"

End With
End Sub