Skip to Content
Oct 01, 2020 at 11:05 AM

Pass a complete FindById SAPGUI script as a Variable


I have collected my SAPGUI scripts into a database, I am trying to retrieve them and use them in my VBA code , however, I am unable to get them to work once I have retrieved them.

Take for example the "enter" code "session.FindById("wnd[0]").SendVKey 0"

When I retrieve "("wnd[0]").SendVKey 0" as a string from the database and add it to the "session.FindById" part, it fails.


If I separate the components "("wnd[0]") and "SendVKey 0" into separate strings, with a dot in between it still does not work


If I pass the Body string, and hard-code the (Arg) part it works

Session.FindById(strSAPGUIBody).SendVKey 0

So it seems to be the passing the second part (arg) as a string variable that is causing the issue?

Any help would be appreciated.