question

GeraldSchaapman-7723 avatar image
0 Votes"
GeraldSchaapman-7723 asked LimitlessTechnology-2700 answered

Excel VBA under Windows 11 AttachThreadInput gives ERROR_ACCESS_DENIED

Hi

I have a VBA code in my Excel project to grab data from a related program. This is done by calling AttachThreadInput to attach input so I can SendKeys.

No problem within Windows 10, everything works.

But under Windows 11 this is not working anymore. The AttachThreadInput gives errno 5 (ERROR_ACCESS_DENIED). I have looked at several settings (windows securiy and anti-virus) and run Excel under Administrator, but nothing helps.

Somebody any idea where to look?

With kind regards
Gerald

windows-11office-vba-dev
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I have no solution, but since this has been sitting in the queue for a while, here is a general observation:
This is very hacky behavior. I would not be surprised if MSFT no longer allows it for its "most secure" OS.
Also VBA is not good at being thread-aware. YMMV.
Maybe if both apps are running using Run as Admin?

0 Votes 0 ·

1 Answer

LimitlessTechnology-2700 avatar image
0 Votes"
LimitlessTechnology-2700 answered

Hi GeraldSchaapman-7723,

AttachThreadInput is not going to work under WIndows 11 as it's a medium integrity process. As this is not a secure way for program threads to operate, you will find that most programs under Windows 11 will not allow it.


I hope this answers your question.



--If the reply is helpful, please Upvote and Accept as answer--

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.