General information
Category:
COM/DCOM and OLE Automation
Paul,
I do something very similar to what you want.
I have a system that creates Word documents, replaces bookmarks with data
then allows the user to carry on from that point.
The important bits of code are:-
oWord=createobject("word.application") && new instance of Word
oWord.documents.open(docFileName) && create document
** Table has a list of valid bookmark names in field bookmark
use locBmark in 0
select locBmark
** Replace Bookmarks
do while not eof()
scatter memvar
if oWord.activedocument.bookmarks.exists(alltrim(m.bookmark))
and not empty(m.data)
xphrase="oWord.activedocument.bookmarks
(alltrimm.bookmark)).range.text="+m.data
&xphrase
endif
skip
enddo
use
oWord.activedocument.save && Save Document
oWord.visible=.t. && Show Word Window
oWord.ActiveWindow.View.Type = 3 && Page Layout View
oWord.WindowState = 1 && Maximise Word Window
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only