Automating Word in the Background


2003-10-25 05:11:29 PM
delphi34
Hello
I have an application which uses OLE automation with MS word.
It needs to open a word document , retrieve some text & close the document
afterwards. All this should be done in the background !
I am using the WordApplication & WordDocument Components.
I am having trouble with controling the focus in my application
i don't want the user to notice word is opening at all , but can not get it
done.
I tried the following:
1. a. Set WordApplication.Visible = True
b. Open The Document and
c. setting wsWindowState = wdWindowStateMinimize RIGHT AFTER the
Word document is opened
This has ALMOST the desired effect but the user still sees MS Word
opening & minimizing
2. a. Set WordApplication.Visible = False
b. Open The WordDocument ( minimized or not have no effect)
However since my application uses the Range.Information[]
property ( to Skip over Tables is the Document )
i'm getting an exception from Word ( the Word VBA help file
does mention that several functions will not work while visible is
False)
Any way to TRUELY automate word without the user noticing ?
Thanks in advance