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

Pass a complete FindById SAPGUI script as a Variable

137 Views

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.

Session.FindById(strSAPGUI)

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

Session.FindById(strSAPGUIBody).strSAPGUIArg

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.

Thanks