ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Waiting... (https://www.excelbanter.com/excel-programming/336612-waiting.html)

Rob Hargreaves[_2_]

Waiting...
 
Hi I have finally finished a major issue i have had with getting excel to
work with word!!

I have come into another problem though and it is a simpler on I hope!

The exchange between excel and word is taking a long time to execute so
after a while Excel gets impatient and gives me the info message

- MS Excel is waiting for another application to complete an OLE action.

Every 10 seconds this pops up.

I know it is possible to use ShellandWait to stop this but I dont have a
clue how to implement it.

Can someone give me the code they have used to supress this.

Thanks
Rob




Ron de Bruin

Waiting...
 
Hi

I know it is possible to use ShellandWait to stop this but I dont have a clue how to implement it.


Use ShellAndWait instead if Shell in your code and
Copy this in a normal module
***********************

Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long

Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, _
lpExitCode As Long) As Long

Public Const PROCESS_QUERY_INFORMATION = &H400
Public Const STILL_ACTIVE = &H103

Public Sub ShellAndWait(ByVal PathName As String, Optional WindowState)
Dim hProg As Long
Dim hProcess As Long, ExitCode As Long
'fill in the missing parameter and execute the program
If IsMissing(WindowState) Then WindowState = 1
hProg = Shell(PathName, WindowState)
'hProg is a "process ID under Win32. To get the process handle:
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, hProg)
Do
'populate Exitcode variable
GetExitCodeProcess hProcess, ExitCode
DoEvents
Loop While ExitCode = STILL_ACTIVE
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Rob Hargreaves" wrote in message ...
Hi I have finally finished a major issue i have had with getting excel to work with word!!

I have come into another problem though and it is a simpler on I hope!

The exchange between excel and word is taking a long time to execute so after a while Excel gets impatient and gives me the info
message

- MS Excel is waiting for another application to complete an OLE action.

Every 10 seconds this pops up.

I know it is possible to use ShellandWait to stop this but I dont have a clue how to implement it.

Can someone give me the code they have used to supress this.

Thanks
Rob







All times are GMT +1. The time now is 11:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com