ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data to a specific location into a word document (https://www.excelbanter.com/excel-programming/324844-data-specific-location-into-word-document.html)

Adam

Data to a specific location into a word document
 
I got this code from Ed (thanks), and I was wondering if there was a way to
possible to get this information into a specific location in a document. I
have this existing template and there is this area for these paragraphs, so I
need to see if it can go in that area.

Set a range to encompass all the rows with data
Set objects to Word and a new document
With DataRange
For i = 1 to DataRange.Rows.Count
String1 = "ID: " & .Cells(i,1).Value & ", "
WordDoc.Selection.TypeText String1 & vbCr
String2 = "Description: " & .Cells(i, 2).Value & ", "
WordDoc.Selection.TypeText String2 & vbCr
etc. to last cell
Next i
Save and close Word doc; quit Word, release objects
Save and close Excel file


Thanks


All times are GMT +1. The time now is 05:00 PM.

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