ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel=Word (https://www.excelbanter.com/excel-programming/361031-excel%3D-word.html)

ChrisMattock[_2_]

Excel=Word
 

I am using an Excel spreadsheet to open a Word template then save it a
a specified name after entering details from the spreadsheet into th
Word document. The trouble I am having is how to define where the dat
is entered. Currently I am using code such as the following...

appWD.Selection.MoveDown Unit:=wdLine, Count:=4
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=2
appWD.Selection.TypeText Text:=strReference

But there are a lot of cells to enter into the 6 page template and thi
gets confusing, not to mention the fact that one small change at th
begining of the template would mean having to redo the other cells. I
there a better way of doing this? How? Perhaps somehow inserting field
in Word that the excel sheet updates?

Please help :D:D:D:

--
ChrisMattoc
-----------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...fo&userid=3391
View this thread: http://www.excelforum.com/showthread.php?threadid=54055


[email protected]

Excel=Word
 
Use bookmarks in word to define the locations you want to populate (in
word, use insert bookmark, or ctrl shift F5 to insert them) - then code
like this

appwd.activedocument.bookmarks("telno").Range = "telephone number"
'obviously range("x1") would work just as well as literal text

PS - IF the word document is really a template, you should be calling
it from file new, which would also stop the template being modified



All times are GMT +1. The time now is 10:04 PM.

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