>>First of all, if you want this just to restrict users editing of the document after preview, make the DOC file created by Word read-only, than open it in Word again and preview.
>
>This means we have to save a copy on disk. It'd like in VFP where all preview would go on disk. Too much management. :) I'd prefer another approach.
>
>>If you wand to close word immediately after preview closed... Well, you than need to find a way HOW distinguish from VFP the states of the Word to see if it is in preview mode or it is just in document editing state. I don't know how. However, if preview cuses modal state in the OLE Automation, than returning control to VFP is a sign of finishing of the preview mode and you can close the document from VFP. If this cause no modal state, than you require to check Word state in a loop and see if Word is still in preview mode...
>
>The way it is now, the control is immediately return to VFP after the preview has been initiated.
>
>After Word has opened the document, this is what we have:
>
>
>loWord.Visible=.T.
>loWord.ActiveDocument.PrintPreview
>
>
>I don't know if there would be such parameter we could pass in PrintPreview to do that.
Hi!
DECLARE integer Sleep in Win32API integer
loWord.Visible=.T.
loWord.ActiveDocument.PrintPreview
#DEFINE nLimitation 300
i = 1
do while loWord.PrintPreview AND i<=nLimitation
sleep(1000)
enddo
loWord.ActiveDocument.CLose.....
.....
HTH.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.