cancel
Showing results for 
Search instead for 
Did you mean: 

Sendvkey not working, but Keyboard entry works fine

Former Member
0 Kudos

Guys this is my first post.

I am making a script to automatically pull data from a hierarchy table.  I'm keying in on one set of data in one column, via another set of data in another column.

When recording the script, I manually press the 'F2' button on the keyboard, but it is recorded as:

session.findById("wnd[0]/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell[1]").doubleClickNode "          2"

Where "     2" looks to be the row number in the visible table.

Since I cannot know for sure which row number they keyed row will return, to pick the data that I actually want to see, this does not allow me to select the exact data I need.

I've tried the following to simulate the 'F2' keyboard strike that SAP sees as the above...

  • Session.findById("wnd[0]").SendVKey 2
  • Application.SendKeys "{F2}"
  • Session.FindById("wnd[0]/shellcont/shell/shellcont[1]/shell/shellcont[1]/shell[1]").PressKey "F2"

How do I simulate the 'F2' keyboard strike that would work so well?!

I'm pulling my freaking hair out over here...HELP!!!


Accepted Solutions (0)

Answers (1)

Answers (1)

stefan_schnell
Active Contributor
0 Kudos

Hello Mike,

you can try this:

Dim wsh

Set wsh = CreateObject("WScript.Shell")

wsh.AppActivate("Title of your window")

wsh.SendKeys "{F2}"

to send a F2.

You can find different other possibilities from VBA here.

Let us know your results.

Cheers

Stefan