From: M Wade on
I have a small sub that has been in a program for many years. I use
the program only once a year in March. The routine is suppose to
intercept an ENTER key and create a Tab key input. The routine is:

If KeyAscii = vbKeyReturn Then
KeyAscii = 0 ' suppress the beep
SendKeys "{tab}"
End If

When the program attempts to execute the sendkeys statement I get the
error indicated. I have attempted to run the program as Administrator
with the same results. Previously the program ran under XP and VISTA.
I now run it under Windows 7.

Could this account for the change in behavior or can anyone point me to
why this happens?

Marv

From: Nobody on
"M Wade" <nowhere(a)columbus.rr.com> wrote in message
news:urbGlLHzKHA.1064(a)TK2MSFTNGP04.phx.gbl...
>I have a small sub that has been in a program for many years. I use the
>program only once a year in March. The routine is suppose to intercept an
>ENTER key and create a Tab key input. The routine is:
>
> If KeyAscii = vbKeyReturn Then
> KeyAscii = 0 ' suppress the beep
> SendKeys "{tab}"
> End If
>
> When the program attempts to execute the sendkeys statement I get the
> error indicated. I have attempted to run the program as Administrator
> with the same results. Previously the program ran under XP and VISTA. I
> now run it under Windows 7.
>
> Could this account for the change in behavior or can anyone point me to
> why this happens?

This was discussed many times. Search the newsgroups for "vb SendKeys
Permission Denied Vista".


From: Karl E. Peterson on
M Wade wrote:
> When the program attempts to execute the sendkeys statement I get the error
> indicated. I have attempted to run the program as Administrator with the
> same results. Previously the program ran under XP and VISTA. I now run it
> under Windows 7.
>
> Could this account for the change in behavior or can anyone point me to why
> this happens?

SendKeys didn't transition well to Vista/Win7. If you have UAC
enabled, you get that error. Best bet is to avoid it entirely. If
it's necessary, and people other than you need to run it, see
http://vb.mvps.org/samples/SendInput for a drop-in alternative.

--
..NET: It's About Trust!
http://vfred.mvps.org