Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VBScript to VBA controlling SAP Script Editor

1,345 views
Skip to first unread message

Martin J.

unread,
Jul 16, 2007, 7:33:45 AM7/16/07
to
An interface to SAP is using the SAP-GUI script Recorder. All the
recorded scripts start like this. I would like to access the SAP-GUI
without using VBScript, but directly from VBA (in this case Access).

What do I have to change to get the Active-X Object ("Session")?

If Not IsObject(Application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set Application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = xlApp.Application.Children(0)
End If
If Not IsObject(Session) Then
Set Session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject Session, "on"
WScript.ConnectObject Application, "on"
End If
Session.findById("wnd[0]").Maximize

jackh

unread,
Jun 17, 2010, 11:13:37 PM6/17/10
to

I hope this helps, as not only am I relatively new to programming, but even more so to SAP interfaces. In VB.Net, rather than having the program look to see if it was an object, I merely dimensioned them as such.

i.e. dim sapguiauto as object
dim sapapplication as object
... and so on. Where before it did not recognize the "IsObject" call, dimensioning them as such bypassed it completely. I have never tried it in VBA, but I have found that often the translation from VB.Net to VBA is not that difficult, most notably in variable references as mentioned above. If this does not work, I will try to send a copy of my VB.net code (that I left at work :( and see if that helps.

Martin J. wrote:

VBScript to VBA controlling SAP Script Editor
16-Jul-07

Previous Posts In This Thread:

On Monday, July 16, 2007 7:33 AM
Martin J. wrote:

VBScript to VBA controlling SAP Script Editor


Submitted via EggHeadCafe - Software Developer Portal of Choice
XAML Organizer
http://www.eggheadcafe.com/tutorials/aspnet/ac373a5d-e497-4e07-9186-12166e83a024/xaml-organizer.aspx

Mayayana

unread,
Jun 18, 2010, 8:57:12 AM6/18/10
to
You're replying to a 3-year-old post? VBScript
and VBA are more different than they look, to
begin with. VB.Net is *very* different. It looks
similar to VB/VBA/VBScript in some ways, but
it's basically an object-oriented Java clone that
runs on the .Net Framework [virtual machine].

An object in VB* is a pointer to a COM
interface. (And VB.Net only peripherally deals
with COM.) While VBScript has no data type
declaration at all. It only deals with COM objects
and variants.

So it's best not to try to mix VB* and VB.Net
at all. Despite Microsoft's marketing strategies
to sell VB.Net to the masses, it has nothing
to do with any kind of VB. They might just as well
have named it MS-BJava.

in...@yottospa.com

unread,
Dec 11, 2012, 4:36:53 AM12/11/12
to
Did you know that with the SAP Standard of Scripting Play & Recording you can save a lot of time in creating of test data, creation of order, deliveries, Invoices etc. We developed a tool which allows you to reduce minimum 90 % of your time in all the tasks you need to do in SAP? You can create hundreds of master data, orders etc within minutes!!! You just need our tool ERPScripting Tool for SAP for just 9,80€. Just visit our web www.ERpScriptingTool.com or just download for free our great tool in http://tinyurl.com/co8jr2y

0 new messages