Technical support and scripting issues
Moderators: Dorian (MJT support), JRL
-
ueberyak
- Junior Coder
- Posts: 31
- Joined: Tue Sep 03, 2013 9:45 pm
Post
by ueberyak » Tue Sep 19, 2017 10:22 pm
I have the following VB/VBEVAL code and all I want to do is get the result back from VB! I keep reading here and there in the forums that this can be done, but I am struggling. I just want to evaluate the result outside of VB.
Code: Select all
function RunSAP
vbstart
on error resume next
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
session.findById("wnd[0]").maximize
session.createSession
VBEND
vbeval>RunSAP,result
mdl>%result%
Thanks,
Josh
-
ueberyak
- Junior Coder
- Posts: 31
- Joined: Tue Sep 03, 2013 9:45 pm
Post
by ueberyak » Tue Sep 19, 2017 10:42 pm
Got it!
Code: Select all
function RunSAP(),result
vbstart
on error resume next
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
session.findById("wnd[0]").maximize
session.createSession
RunSAP=Err.number
VBEND
vbeval>RunSAP,result
mdl>Result: %result%
Thanks,
Josh