From: Jack on
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

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

Previous Posts In This Thread:

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

VBScript to VBA controlling SAP Script Editor
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


Submitted via EggHeadCafe - Software Developer Portal of Choice
XAML Organizer
http://www.eggheadcafe.com/tutorials/aspnet/ac373a5d-e497-4e07-9186-12166e83a024/xaml-organizer.aspx
From: Mayayana on
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.

|
| 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.
|