Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word97
Message
From
03/08/1998 12:19:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/08/1998 11:00:18
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Word97
Miscellaneous
Thread ID:
00123542
Message ID:
00123568
Views:
24
>Hello,
>
>I have a problem with OLE automation to Word. I have an existing .dot file with unknown number of bookmarks. I try to find out the names of the bookmarks and replace them with the apropriate data. Behind the bookmarks should be the variables (identical with the fields in in my VFP table) and expressions combining these variables. It is functioning well with the single variables. But I can not find out the content of a bookmark where there is an expression. Can somebody help me further? I would appreciate any help - I am quite new with OLE.
>
>Milos Klas
Hi Milos,
There is a bookmarks and variables collection. To set all variables to field contents (var names match with fields as you said) :
cMyTable = "mytablename"
oWord = createobject("word.application")
with oWord.activedocument
  for ix=1 to fcount(cMyTable)
      .variables(field(ix,cMyTable)).value = eval(field(ix,cMyTable))
  endfor
endwith
And similarly bookmarks collection can be controlled as :
cMyTable = "mytablename"
oWord = createobject("word.application")
with oWord.activedocument
  for ix=1 to fcount(cMyTable)
      if .bookmarks.exists(field(ix,cMyTable))
         .bookmarks(field(ix,cMyTable)).select
         oWord.selection.insertafter(eval(field(ix,cMyTable)))
      endif
  endfor
endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform