Skip to Content
avatar image
Former Member

Sendvkey not working, but Keyboard entry works fine

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!!!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 06, 2015 at 07:21 AM

    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.



    Add comment
    10|10000 characters needed characters exceeded