Home > Software engineering >  Consult: recorded a VBS in SAP, how to rewrite the VBA.
Consult: recorded a VBS in SAP, how to rewrite the VBA.

Time:10-28

Consult: recorded a VBS in SAP, how to rewrite into VBA,
Below is the recording tool, using the SAP recorded vbscript,
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
If Not IsObject (application) Then
Set SapGuiAuto=GetObject (" SAPGUI ")
Set application=SapGuiAuto. GetScriptingEngine
End the If
If Not IsObject (connection) Then
Set the connection=application. Children (0)
End the If
If Not IsObject (session) Then
Set the session=connection. The Children (0)
End the If
If IsObject (WScript) Then
WScript. ConnectObject session, "on"
WScript. ConnectObject application, "on"
End the If
Session. FindById (" WND [0] "). The resizeWorkingPane 172, false
Session. FindById (" WND [0]/usr/cntlIMAGE_CONTAINER shellcont/shell/shellcont [0]/shell "). The expandNode "F00009
"Session. FindById (" WND [0]/usr/cntlIMAGE_CONTAINER shellcont/shell/shellcont [0]/shell "). The expandNode "F00057
"Session. FindById (" WND [0]/usr/cntlIMAGE_CONTAINER shellcont/shell/shellcont [0]/shell "). The selectedNode="F00202
"Session. FindById (" WND [0]/usr/cntlIMAGE_CONTAINER shellcont/shell/shellcont [0]/shell "). The topNode="Favo
"Session. FindById (" WND [0]/usr/cntlIMAGE_CONTAINER shellcont/shell/shellcont [0]/shell "). The doubleClickNode "F00202
"Session. FindById (" WND [0]/shellcont/shellcont/shell/shellcont [1]/shell/shellcont [1]/shell "). The topNode="23"
Session. FindById (" WND [0]/shellcont/shellcont/shell/shellcont [1]/shell/shellcont [1]/shell "). The doubleClickNode "36"
Session. FindById (" WND [0]/shellcont/shellcont/shell/shellcont [0]/shell/shellcont [1]/shell "). The expandNode "000003"
Session. FindById (" WND [0]/shellcont/shellcont/shell/shellcont [0]/shell/shellcont [1]/shell "). The topNode="000001"

CodePudding user response:

VBS code to remove option explicit vba can use directly;

CodePudding user response:

If Not IsObject (application) Then
The application need to define an object in the variable, and then create a moment,

CodePudding user response:

Upstairs said, also suggested that the general part into a custom function, then directly with object invokes the function block is very convenient
  •  Tags:  
  • VBA
  • Related