ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I merge Excel data into MS Word (https://www.excelbanter.com/excel-programming/330693-how-can-i-merge-excel-data-into-ms-word.html)

Troy[_8_]

How can I merge Excel data into MS Word
 
Is it possible to pull information from an Excel spreadsheet into Word. If
so can someone pls explain how to do it.

Thanks



Daniel CHEN

How can I merge Excel data into MS Word
 
Here is some sample code which write data in range A1:A10 into a new word
file.
Possibly, you need a reference to MS Word Object Library.


Sub Put2Word_Click()

Dim wdApp As Object, i As Integer
Set wdApp = CreateObject("Word.Application")
With wdApp
.Documents.Add
.Visible = True
End With
With wdApp.Selection
.Font.Name = "Arial" ' set font
.Font.Bold = True
.Font.Size = 12
For i = 1 To 10
.TypeText Text:=CStr(Cells(i, 1))
.TypeParagraph
Next i
End With
wdApp.Activate
Set wdApp = Nothing

End Sub

"Troy" wrote in message
...
Is it possible to pull information from an Excel spreadsheet into Word. If
so can someone pls explain how to do it.

Thanks





Paul Barnett

How can I merge Excel data into MS Word
 
Hi

Thanks for the excellent code. It seems then it is not as simple as
using the mail merge wizard options. I may come back to you further if I
get probs if that is ok

Paul

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 02:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com