Yes, but I don't understand why that should not fix your problem. If you don't send any commands to Excel for a period, Excel should work on it's own anyway doing nothing, and then there should be no need for any more delay, as far as I can see. Have you tried to run one command at a time from the command window?
>It's Excel that's busy somehow so the messagebox comes up with the select, retry option
>
>wait window just postpones the problem by 1 second
>Peter
>
>
>>Hi Peter,
>>
>>You can add any VFP code anywhere, just add a WAIT TIMEOUT 1 WINDOW or something like that before your problem line.
>>
>>>the following code stops:
>>>
>>>oExcel=CREATEOBJECT("excel.application")
>>>oExcel.DisplayAlerts=.F.
>>>oWorkBook=oExcel.workbooks.ADD()
>>>oSheet=oWorkBook.Worksheets(1)
>>>WITH oSheet.PageSetup
>>>.Orientation=1 <----------------------------HERE !!!!!!!!
>>>.FitToPagesTall=1
>>>.FitToPagesWide=1
>>>.CenterHorizontally=.T.
>>>.CenterVertically=.F.
>>>.TopMargin=1*72
>>>.LeftMargin=.75*72
>>>.RightMargin=.5*72
>>>.RightHeader="Page &P of &N"
>>>.LeftHeader="&F"
>>>.RightFooter="Printed on &D"
>>>.FooterMargin=.5*72
>>>.HeaderMargin=.5*72
>>>
>>>
>>>ENDWITH
>>>
>>>I assume it times out somehow( running on Terminal Server 2000 )
>>>Can I change the timout when talking to EXCEL?
>>>
>>>Peter