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