Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word Automation Documentation
Message
From
29/06/2000 09:00:39
Alec Dearden
Peterborough Hospitals Nhs Trust
Peterborough, United Kingdom
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00384576
Message ID:
00386376
Views:
30
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
Map
View

Click here to load this message in the networking platform