ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2003, Vista, and Sendkeys (https://www.excelbanter.com/excel-programming/385674-excel-2003-vista-sendkeys.html)

Bob Flanagan

Excel 2003, Vista, and Sendkeys
 
Greetings. I just reformatted one of my PCs, installed Windows Vista and
then Excel 2003 so that I had a clean installation. I found that Sendkeys
does not work on Excel 2003 on Windows Vista. I recognize that Sendkeys
should only be used when all else fails, but there are those situations.

The solution is to do the following: (in this case for File, Open)

Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
wshShell.SendKeys "%FO", True

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel




Gary''s Student

Excel 2003, Vista, and Sendkeys
 
Hi Bob:

This is a little disturbing. If you run:

Sub test()
Range("A1").Select
Application.SendKeys "{F2}"
Application.SendKeys "Hi Bob"
Application.SendKeys "{ENTER}"
End Sub


would you get an error mesage ?
--
Gary''s Student
gsnu200711


Bob Flanagan

Excel 2003, Vista, and Sendkeys
 
I just ran the test on sending "hi bob" (that seemed the best to me <g).
It does not work in Excel 2003 on a clean vista install. It does work on
Excel 2007.

Bob

"Gary''s Student" wrote in message
...
Hi Bob:

This is a little disturbing. If you run:

Sub test()
Range("A1").Select
Application.SendKeys "{F2}"
Application.SendKeys "Hi Bob"
Application.SendKeys "{ENTER}"
End Sub


would you get an error mesage ?
--
Gary''s Student
gsnu200711




NickHK

Excel 2003, Vista, and Sendkeys
 
Bob,
What about:
Application.GetOpenFilename

NickHK

"Bob Flanagan" wrote in message
...
Greetings. I just reformatted one of my PCs, installed Windows Vista and
then Excel 2003 so that I had a clean installation. I found that Sendkeys
does not work on Excel 2003 on Windows Vista. I recognize that Sendkeys
should only be used when all else fails, but there are those situations.

The solution is to do the following: (in this case for File, Open)

Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
wshShell.SendKeys "%FO", True

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel






Bob Flanagan

Excel 2003, Vista, and Sendkeys
 
Nick, my example was just to illustrated a use of a simple sendkeys in 2003
on a Vista platform. Sendkeys (and Application.Sendkeys) is just ignored
when run by 2003 on Vista - and no error messages occured at all. Which is
very strange. It makes one wonder what else will not work in 2003 on a
Vista platform, and not give errors......

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"NickHK" wrote in message
...
Bob,
What about:
Application.GetOpenFilename

NickHK

"Bob Flanagan" wrote in message
...
Greetings. I just reformatted one of my PCs, installed Windows Vista and
then Excel 2003 so that I had a clean installation. I found that
Sendkeys
does not work on Excel 2003 on Windows Vista. I recognize that Sendkeys
should only be used when all else fails, but there are those situations.

The solution is to do the following: (in this case for File, Open)

Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
wshShell.SendKeys "%FO", True

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel








NickHK

Excel 2003, Vista, and Sendkeys
 
Bob,
As Vista is designed to be more secure, some aspects of "easy" programming
are no longer valid. May depend if you have UAC active or not.
Here a VB thread along similar lines with a couple of solutions/thoughts.
See the link on the last post.
http://groups.google.co.uk/group/mic...fc5864 e1d061

But as suggested, it may be better to try and remove those calls, for future
compatibility.

NickHK

"Bob Flanagan" wrote in message
...
Nick, my example was just to illustrated a use of a simple sendkeys in

2003
on a Vista platform. Sendkeys (and Application.Sendkeys) is just ignored
when run by 2003 on Vista - and no error messages occured at all. Which

is
very strange. It makes one wonder what else will not work in 2003 on a
Vista platform, and not give errors......

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"NickHK" wrote in message
...
Bob,
What about:
Application.GetOpenFilename

NickHK

"Bob Flanagan" wrote in message
...
Greetings. I just reformatted one of my PCs, installed Windows Vista

and
then Excel 2003 so that I had a clean installation. I found that
Sendkeys
does not work on Excel 2003 on Windows Vista. I recognize that

Sendkeys
should only be used when all else fails, but there are those

situations.

The solution is to do the following: (in this case for File, Open)

Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
wshShell.SendKeys "%FO", True

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel










Bob Flanagan

Excel 2003, Vista, and Sendkeys
 
Nick, thanks for the link. It will be helpful. What is strange is that
sendkeys works in Excel 2007 on the same machine, but does not work in Excel
2003 on it. And there are simple work arounds. So, I doubt that it was
stopped from working due to security reasons. I suspect that Microsoft
screwed up is a more likely explanation. Not that they could do so.

There are some good reasons to use sendkeys. For example, say that your
last command in a macro is to delete cell entries. If done with vb code,
then undo will not work. If done with sendkeys, undo does work.

Bob

"NickHK" wrote in message
...
Bob,
As Vista is designed to be more secure, some aspects of "easy" programming
are no longer valid. May depend if you have UAC active or not.
Here a VB thread along similar lines with a couple of solutions/thoughts.
See the link on the last post.
http://groups.google.co.uk/group/mic...fc5864 e1d061

But as suggested, it may be better to try and remove those calls, for
future
compatibility.

NickHK

"Bob Flanagan" wrote in message
...
Nick, my example was just to illustrated a use of a simple sendkeys in

2003
on a Vista platform. Sendkeys (and Application.Sendkeys) is just
ignored
when run by 2003 on Vista - and no error messages occured at all. Which

is
very strange. It makes one wonder what else will not work in 2003 on a
Vista platform, and not give errors......

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"NickHK" wrote in message
...
Bob,
What about:
Application.GetOpenFilename

NickHK

"Bob Flanagan" wrote in message
...
Greetings. I just reformatted one of my PCs, installed Windows Vista

and
then Excel 2003 so that I had a clean installation. I found that
Sendkeys
does not work on Excel 2003 on Windows Vista. I recognize that

Sendkeys
should only be used when all else fails, but there are those

situations.

The solution is to do the following: (in this case for File, Open)

Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
wshShell.SendKeys "%FO", True

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel












Jim Rech

Excel 2003, Vista, and Sendkeys
 
Hi Bob-

I finally got to run the Hi Bob macro at home where I have Vista installed.
It ran fine in Excel 2003 with UAC off. With it turned back on the
Application.Sendkeys parts were not executed. Interestingly, if I used VB
Sendkeys (removing "Application.") they were executed.

I found both versions run in Excel 2007 with UAC on, as you did.

I don't use Sendkeys much but when I do I use the VB version. Just lazy I
guess.

--
Jim
"Bob Flanagan" wrote in message
. ..
Nick, thanks for the link. It will be helpful. What is strange is that
sendkeys works in Excel 2007 on the same machine, but does not work in
Excel 2003 on it. And there are simple work arounds. So, I doubt that it
was stopped from working due to security reasons. I suspect that
Microsoft screwed up is a more likely explanation. Not that they could do
so.

There are some good reasons to use sendkeys. For example, say that your
last command in a macro is to delete cell entries. If done with vb code,
then undo will not work. If done with sendkeys, undo does work.

Bob

"NickHK" wrote in message
...
Bob,
As Vista is designed to be more secure, some aspects of "easy"
programming
are no longer valid. May depend if you have UAC active or not.
Here a VB thread along similar lines with a couple of solutions/thoughts.
See the link on the last post.
http://groups.google.co.uk/group/mic...fc5864 e1d061

But as suggested, it may be better to try and remove those calls, for
future
compatibility.

NickHK

"Bob Flanagan" wrote in message
...
Nick, my example was just to illustrated a use of a simple sendkeys in

2003
on a Vista platform. Sendkeys (and Application.Sendkeys) is just
ignored
when run by 2003 on Vista - and no error messages occured at all. Which

is
very strange. It makes one wonder what else will not work in 2003 on a
Vista platform, and not give errors......

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"NickHK" wrote in message
...
Bob,
What about:
Application.GetOpenFilename

NickHK

"Bob Flanagan" wrote in message
...
Greetings. I just reformatted one of my PCs, installed Windows Vista

and
then Excel 2003 so that I had a clean installation. I found that
Sendkeys
does not work on Excel 2003 on Windows Vista. I recognize that

Sendkeys
should only be used when all else fails, but there are those

situations.

The solution is to do the following: (in this case for File, Open)

Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
wshShell.SendKeys "%FO", True

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel













Bob Flanagan

Excel 2003, Vista, and Sendkeys
 
Hi Jim. I too don't use too often. I use where I can if it keeps undo
active.

Strangely, I had both Sendkeys and Application.Sendkeys not work in 2003.
It could be slight differences in installs and updates. I had not run any
updates on the PC as I want it as close to what I call the worst case
install of windows and Excel that I can think of.

Bob

"Jim Rech" wrote in message
...
Hi Bob-

I finally got to run the Hi Bob macro at home where I have Vista
installed. It ran fine in Excel 2003 with UAC off. With it turned back on
the Application.Sendkeys parts were not executed. Interestingly, if I
used VB Sendkeys (removing "Application.") they were executed.

I found both versions run in Excel 2007 with UAC on, as you did.

I don't use Sendkeys much but when I do I use the VB version. Just lazy I
guess.

--
Jim
"Bob Flanagan" wrote in message
. ..
Nick, thanks for the link. It will be helpful. What is strange is that
sendkeys works in Excel 2007 on the same machine, but does not work in
Excel 2003 on it. And there are simple work arounds. So, I doubt that
it was stopped from working due to security reasons. I suspect that
Microsoft screwed up is a more likely explanation. Not that they could
do so.

There are some good reasons to use sendkeys. For example, say that your
last command in a macro is to delete cell entries. If done with vb code,
then undo will not work. If done with sendkeys, undo does work.

Bob

"NickHK" wrote in message
...
Bob,
As Vista is designed to be more secure, some aspects of "easy"
programming
are no longer valid. May depend if you have UAC active or not.
Here a VB thread along similar lines with a couple of
solutions/thoughts.
See the link on the last post.
http://groups.google.co.uk/group/mic...fc5864 e1d061

But as suggested, it may be better to try and remove those calls, for
future
compatibility.

NickHK

"Bob Flanagan" wrote in message
...
Nick, my example was just to illustrated a use of a simple sendkeys in
2003
on a Vista platform. Sendkeys (and Application.Sendkeys) is just
ignored
when run by 2003 on Vista - and no error messages occured at all.
Which
is
very strange. It makes one wonder what else will not work in 2003 on a
Vista platform, and not give errors......

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"NickHK" wrote in message
...
Bob,
What about:
Application.GetOpenFilename

NickHK

"Bob Flanagan" wrote in message
...
Greetings. I just reformatted one of my PCs, installed Windows
Vista
and
then Excel 2003 so that I had a clean installation. I found that
Sendkeys
does not work on Excel 2003 on Windows Vista. I recognize that
Sendkeys
should only be used when all else fails, but there are those
situations.

The solution is to do the following: (in this case for File, Open)

Dim wshShell
Set wshShell = CreateObject("WScript.Shell")
wshShell.SendKeys "%FO", True

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
















All times are GMT +1. The time now is 07:10 PM.

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