>Is there an *.h file with all the constants that Word2000 uses. Also is there any good books on OLE Automation of particularly Word or the entire Office Suite. I am trying to create a Word *.Doc of a quotation, with data from VFP5.0, that can be attached to an E-mail and sent to the respective party. I am having a heck of a time trying to figure out how to move around in Word. I just want to do some basic formating, like set some tabs and change some font sizes. I just can't seem to figure out how to control the "Insert point" very well. Any guidance would be much appreciated
>
>Thanks in Advance.
>
>Jon
There is no mention about a difference in header files of w97 and w2000 in MSDN lib. w97 constants should be in files section. Help file is ...\Microsoft Office\Office\vbawrd8.hlp for w97.
Understanding insertion point is a challenge :) But not only that if you go that way. It would be slow too (VBA).
Instead create a template in word with formatting as you want. Instead of hardcoded text use fieldcodes. ie: insert fields :
DOCVARIABLE "cFirst_name" \* MERGEFORMAT
DOCVARIABLE "cLast_name" \* MERGEFORMAT
and do any formatting in word. Then uncheck tools\Options\Field codes if checked.
from VFP all you have to do is :
oWordDocument = createobject("Word.Application")
with oWordDocument
.Documents.Add("c:\mypath\mysavedtemplate.doc")
with .Activedocument
_SetVar("cFirst_Name", myTable.First_name)
_SetVar("cLast_Name", myTable.Last_name)
endwith
.Visible = .t.
endwith
FUNCTION _SetVar
LPARAMETERS tcVarName, tcVarValue
.Variables(tcVarName).value = iif(empty(tcVarValue)," ",tcVarValue)
This works pretty well for one record templates (or Parent table data).
Cetin