>Hello James,
>thanks for your reply, do you mean run the Crystal Report and export it to a new file, then insert it into my document?
>
>thanks
>
>Pete
Yes, I have a method call (RunCrystalReport()) prior to the sample code I sent in my last message that will run the crystal report (using automation) and then I insert the generated export document into my Word document. So the code goes more like the following:
**********
#include '\include\wd97cons.h'
local lcDocFile,lcExpFile,lcRptFile
lcDocFile = 'c:\app\docs\customers.doc'
lcExpFile = 'c:\temp\export.doc'
lcRptFile = 'c:\app\reports\customers.rpt'
if This.RunCrystalReport(lcRptFile)
This.oWord = createobject('Word.Application')
if vartype(This.oWord) = 'O'
with This.oWord
.WindowState = wdWindowStateMinimize
.Visible = .T. && Some Word functions will not work unless visible.
.Documents.Open(lcDocFile,.T.,.T.)
.Selection.EndKey(wdStory)
.Selection.InsertBreak(wdSectionBreakNextPage)
.Selection.InsertFile(lcExpFile,'',.F.,.F.,.F.)
.ActiveDocument.Save()
* Display for the user. Let the user close when finished.
.WindowState = wdWindowStateMaximize
endwith
This.oWord = null
endif
if file(lcExpFile)
delete file (lcExpFile)
endif
endif
**********
HTH,
James