Problem (Compatibility?) on excel automation [macro] with MS Office Professional Plus 2021
Problem (Compatibility?) on excel automation [macro] with MS Office Professional Plus 2021
(OP)
Some users encounter problems with excel output using Office 2021. Sometimes, the system hang, then a window pops up:
This action cannot be completed because the other program is busy. Choose 'Switch To' to activate the busy program and correct the problem. [Switch To...][Retry]
What could be the problem? Could it be that the macro codes are not compatible anymore? I used the following variables:
Could it be that the integer values have different values in Office 2021?
- gryff15 -
This action cannot be completed because the other program is busy. Choose 'Switch To' to activate the busy program and correct the problem. [Switch To...][Retry]
What could be the problem? Could it be that the macro codes are not compatible anymore? I used the following variables:
CODE --> vfp7
#Define xlEdgeBottom 9 #Define xlEdgeLeft 7 #Define xlEdgeRight 10 #Define xlEdgeTop 8 #Define xlDiagonalDown 5 #Define xlDiagonalUp 6 #Define xlNone -4142 #Define xlThin 2 #Define xlContinuous 1 #Define xlInsideHorizontal 12 #Define xlInsideVertical 11 #Define xlCenter -4108 #Define xlBottom -4107 #Define xlContext -5002 #Define xlRight -4152 #Define xlUnderlineStyleNone -4142 #Define xlLandscape 2 #Define xlAutomatic -4105 #Define xlSolid 1 #Define xlThemeColorDark1 1
Could it be that the integer values have different values in Office 2021?
- gryff15 -
RE: Problem (Compatibility?) on excel automation [macro] with MS Office Professional Plus 2021
You haven't really given us enough information to postulate further
Regards
ing
Griff
Keep
I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
There is no place like G28 X0 Y0 Z0
RE: Problem (Compatibility?) on excel automation [macro] with MS Office Professional Plus 2021
The message usually crops up when you have an instance of the target application (Excel in this case) running as a COM server and another running interactively, and there is clash of some kind whdn you try to access them both at the same time. I can't give you a more specific answer, but I find I can usually cure it by closing one or other of the instances.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads
RE: Problem (Compatibility?) on excel automation [macro] with MS Office Professional Plus 2021
Setting these properties is no magic recipe for any case. To debug your case I therefore recommend before starting to play with these things make your Excel.Application visible for debugging the case. Automation will slow down with a visible Excel window, but you may find what's blocking. It may hang on a message displayed.
But to showcase how this message is coming up, compile this into a COM Server and create an instance of it with CREATEOBJECT("yourexe.OLEblocking"):
CODE
You'll see the message with [Switch To...][Retry] and a disabled [Cancel} button appears. In case of this READ EVENTS blocking all further execution in VFP, neither waiting nor any setting of both timeouts and RaiseError helps, actually. It's simply Read Events not returning that's causing a deadlock, usually a block may also resolve itself, if it's just a long running process.
If you see any message popup there might be ways to avoid it by avoiding the reason causing the message or by a suppression mechanism. Like you can suppress some alerts with the Application.DisplayAlerts setting. Als don't try that first, you never know what messages you suppress. It's a bad decision that in Ole Automation some things still cause the display of alerts instead of triggering error in the process automating Excel, which would make problems far easier to detect and fix. And if it really simply runs long it helps users see it to stay patient, even if they wait longer. I even had users say: Wow, this is fast. Well, how easy are users impressed on something appearing faster than you can type, but are not at all impressed when something just appears at one moment after a short waiting time.
PS: It can also sometimes help to do some automation tasks with VBS inside an Excel template, though Macro execution is harder for security reasons than automating. Quite inconsequential, if you ask me, as automation gives you even more possibilities to do things with the help of the code automating the ole server than the internal VBA can.
Chriss
RE: Problem (Compatibility?) on excel automation [macro] with MS Office Professional Plus 2021
I put wait windows to see where it starts to hang.
It hangs on:
CODE --> vfp7
- gryff15 -