Information générale
Catégorie:
COM/DCOM et 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
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement