From: Anonymous on

"Trevor Smith" <t�evs.mailbox(a)googlemail.�om> wrote in message
news:eqb2ab$im8$1(a)news.freedom2surf.net...
....
>
> I did think about using the XML output from Word or OpenOffice but it
> would take (quite) a while for me to run up to speed with that and I
> already had a solution using Rich Text. It was just that Outlook seemed to
> be getting in the way.

Just in case you are considering XML, check out this new article:
http://www.voconversion.com.au/Article%20Archive/Generating%20business%20documents%20using%20XML%20and%20MS.mht
on VoConversion.

Note that this approach will only work with Office 2003 Proffessional or
Office 2007.

Ed


From: Trev on
On Feb 6, 12:11 pm, Trevor Smith <t®evs.mailbox(a)googlemail.©om> wrote:
> I am using ShellExecuteEx to open up a Word form and then when the user
> closes the document I examine the form and retrieve data from some of
> the fields to put into a database. This works well except when the user
> has Outlook running at the same time and then the program doesn't wait
> for Word to finish and drops straight through to the UpdateCheck routine.
>
> Is there any way to prevent this other than getting the user to close
> Outlook?
>
> The code goes like this:
>
> // open the doc in Word
> lpShellInfo.cbSize := _SizeOf( _winShellExecuteInfo )
> lpShellInfo.hwnd := self:Handle()
> lpShellInfo.lpVerb := String2Psz("open")
> lpShellInfo.lpFile := String2Psz( cFile )
> lpShellInfo.nShow := SW_ShowNormal
> lpShellInfo.fMask := SEE_MASK_NOCLOSEPROCESS
>
> if ShellExecuteEx( @lpShellInfo )
> hProc := lpShellInfo.hProcess
> GetExitCodeProcess( hProc, @lpExitCode )
> lRunning := ( lpExitCode == STILL_ACTIVE )
> while lRunning
> GetExitCodeProcess( hProc, @lpExitCode )
> lRunning := ( lpExitCode == STILL_ACTIVE )
> Yield()
> end
>
> // see if the user wants to retrieve any fields from the // saved doc
> oUC := UpdateCheck{self}
> oUC:File := cFile
> oUC:Show()
> end
>
> Thanks
> Trevor

I managed to solve this problem in the end by checking for the file
that Word creates when a document is opened for editing. The document
has the same name as the opened file except for the first to
characters which are changed to ~$ As long as this file exists I loop
around. I wasn't able to get the file handle.

Trevor