General information
Category:
COM/DCOM and OLE Automation
Environment versions
Network:
Windows 2008 Server
>Hi!!!,
>
>
>I want to use MS Word from my VFP app, in order to keep a record of a doctor's patient visits.
>
>Any ideas?.
>
>I try to use:
>
>* =============================================
>loWord = CREATEOBJECTt("Word.Application")
>loWord.Documents.Add()
>loRange = loWord.ActiveDocument.Range()
>
>Select ficha (My View)
>Go top
>
>Scan
> loRange.InsertAfter(ficha.otrospadec + ' ')
>Endscan
>
>loWord.ActiveDocument.SaveAs("C:\clinica\Prueba.docx")
>
>loWord.Documents.OPEN("C:\clinica\Prueba.docx",.F.,.F.)
>
>Release loRange, loWord
>
>* =============================================
>
>Sometimes it works ok, some other times it hangs and leaves a copy of MS Word running, and, ... well, you get the idea.
In addition to Tore's advice, I don't see anything here where you're closing Word. Don't just release the variable. First, shut Word down:
loWord.Quit()
Tamar
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only