Thanks Fernando
In practice it is not the print dialog that is causing the problem - I just 
used it to replicate the problem.  In practice my app does not want Word to be 
visible but Word is sometimes bring up some unknown dialog on some machines.  

Is there a way in Windows to make an application visible after it been created 
invisible in VFP?

-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of Fernando D. 
Bozzo
Sent: 12 June 2015 11:43
To: [email protected]
Subject: Re: OLE Automation - This action cannot be completed because the other 
program is busy

Hi Paul:

I've made a quick test, and I think you can use something like this:


LOCAL oo as Word.Application
oo = CreateObject('Word.Application')
oo.Documents.Add()
oo.Visible= .T.
oo.Dialogs(88).Show(5000)
oo.Application.Quit(0)


I assuming some things here (may be wrong, please, correct me):

1) I've made the Word Application visible, because I see no sense in not 
showing the main window when the printer dialog is invoked so the user can 
choose the printer options.

2) I've added a timeout of 5 secs to the dialog so it autocloses and do not 
wait forever

3) I use Quit(0) to make sure that the "Save, Ignore, Cancel" dialog does not 
show, which can hang Word again waiting forever

Note: In testing this code, I've found that if I keep Word Application 
Invisible (not adding Visible=.T.), then when the timeout of 5 secs ends, the 
doc is automatically printed. May be this is what are you looking for?


Regards.-


2015-06-12 11:43 GMT+02:00 Paul Newton <[email protected]>:

> Hi all
>
> I do NOT want to set OLERequestPendingTimeout and/or 
> OLEServerBusyTimeout to 0.  If they are set to their default values 
> and regardless of the setting for OLEServerBusyRaiseError, this dialog 
> is displayed if for example the word application has an open dialog.  
> This can be demonstrated with the following code:
>
> o = CreateObject('Word.Application')
> o.Documents.Add
> o.Dialogs(88).Show
> o.Application.Quit
>
> I was wondering if there might be some way (BindEvents?) to let FoxPro 
> know when this dialog (not the Word dialog but the Action cannot be 
> completed one) is displayed
>
> Many thanks
>
> Paul Newton
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to