How To Get VBEVAL Result?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ueberyak
Junior Coder
Posts: 31
Joined: Tue Sep 03, 2013 9:45 pm

How To Get VBEVAL Result?

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

Re: How To Get VBEVAL Result?

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

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts