Excel Automation from other apps - Can a "blocked or locked" excel state be checked?

mburns_08109

New Member
Joined
Jun 11, 2019
Messages
4
I'm asking a general question here - not one that applies to a specific issue (yet!).

When automating excel - you have two choices:
1) create a new instance of Excel
2) find an existing (open) instance of Excel programmatically and use it.

For option #2 only:
if you use API calls to grab a handle to an existing Excel.Application - is there any means of using Win32 API calls or some automation APIs to test the status or state of that Application instance PRIOR to attempting to actually use it via automation?

What I'm concerned with is:
is it already running a macro or VBA code? (if so, it will likely be blocked for automation calls)
is it in a locked/blocked state because the Excel UI was left in a "editing a cell value" state by the last user interaction? (will definitely be blocked)
...or other causes that may make the application unresponsive to Automation requests (like Open/create a new workbook, for example)? (??)
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,148,193
Messages
5,745,272
Members
423,941
Latest member
CluelessAboutExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top