Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendkeys not work in Offcie 2007?

Status
Not open for further replies.

RBSTR

Programmer
Nov 10, 2005
71
GB
Hi

I have an app that sends data to the previously opened application.

One use is to send data into Word or Excel. I use sendkeys - such as...

SendKeys txtLine1.Text
SendKeys "{ENTER}"

I have noticed, however, that it does not seem to work in Excel/Word 2007 - the cursor seems to remain where it is without the data being sent in.

If I try it, say, into Notepad all works as expected. I'm certain it used to be OK in Office 2000.

Any ideas?
 
Try posting this in forum707. This is a Visual Basic 5 & 6 forum. Good luck!

Cogito eggo sum – I think, therefore I am a waffle.
 
Hi RBSTR,

Sendkeys didn't work in the original Vista release.

AFAIK, the .NET Framework 3.0 (which is a std Vista update) restored Sendkeys functionality. See:
You should check that both your OS and you copy of Office 2007 are fully updated.



Cheers
[MS MVP - Word]
 
Macropod, I'd suggest that

>If I try it, say, into Notepad all works as expected

strongly indicates that it isn't the Vista issue that you mention.

The problem is that SendKeys is actually a nasty hack. The fact that it ever works properly continually suprises me. When it comes to Office 2007 the hack breaks down a bit due to a number of what appear to be timing issues (.NET gets around this by providing an alternative hack, but unfortunately this alternative isn't available to us in VB).

One thing that can help alleviate the problem seems to be to ensure that Wait is set to false
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top