Excel=>Word

C

ChrisMattock

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:
 
A

aidan.heritage

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top