Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

SAP GUI Scripting with VB.NET

I try to write VB.NET application using SAP GUI Scripting classes. Two first lines of the code below attaches SAPLogOn to the script. It works OK. When I try to set object "connection" ( third line)I receive an error.

"An unhandled exception of type 'System.InvalidCastException' occurred.Specified cast is not valid"

SapGuiAuto = GetObject("SAPGUI")

application = SapGuiAuto.GetScriptingEngine

connection = application.Children

Maybe somebody knows how to write that code properly?

In VB6 there is no problem. Third line looks like:

connection = application.Children(0)

Former Member
Not what you were looking for? View more on this topic or Ask a question