on 12-30-2011 7:33 PM
I am creating forms (in Microsoft Visual Studio 2010) to interact between SAP and Excel and everything runs fine but I can't disconnect the script when its finished.
SapGuiAuto = GetObject("SAPGUI")
ApplicationSAP = SapGuiAuto.GetScriptingEngine
For Connect = 1 To ApplicationSAP.Children.Count
chkme = ApplicationSAP.Children.Count
Connection = ApplicationSAP.Children(Connect - 1)
Session = Connection.Sessions(0)
clientDISP = Sessionsap.INFO.clienT
sessiondisp = Sessionsap.INFO.systemName
Next
SapGuiAuto = Nothing
ApplicationSAP = Nothing
Connection = Nothing
The following line disconnects when written in Excel VB but does not work with Microsoft forms:
Session = Nothing
The script running icon (barber pole) is always spinning after running this, how do I disconnect (end script connection)?
Thanks,
Brian
Edited by: BFeaster on Dec 30, 2011 8:57 PM
Hi Brian,
I would always use for the objects the command "set".
For example:
set session = nothing
Much more important is than the script running icon (barber pole), the fact that wscript.exe is not visible in Task Manager when a script is closed. In theory you should not set objects on nothing. These will be destroyed automatically when you exit the script.
The end of a script can also be initiated by this command:
wscript.quit
Regards,
ScriptMan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks ScriptMan
the "Set" command works with vb in excel but when using Visual Studio (2010), the program automatically removes it as its not needed.
As far as the "wscript.quit", the "wscript" is not recognized so I assume it has to be initialized.
I'm not sure how I would initialize it to be seen as the running script.
Thanks again for the help, let me know if you have any other ideas.
Edited by: BFeaster on Jan 3, 2012 3:18 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.