This is some recorded code from SAP to select a node within a VA03/CU51 transaction.
I'm looking to run a while loop that selects and deletes certain nodes.
I want to be able to select the current node within my while loop. How can I do this?
Thanks, Greg
Code:
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = 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
session.findById("wnd[0]/shellcont/shell").selectedNode = "00000003"
session.findById("wnd[0]/shellcont/shell").doubleClickNode "00000003"
I'm looking to run a while loop that selects and deletes certain nodes.
Code:
Dim i As Integer
Dim substring As String
i = 1
Do While Session.findById("wnd[0]/shellcont/shell").getNodeTextByPath("1\" & i) <> "" ' loops through all nodes
substring = Session.findById("wnd[0]/shellcont/shell").getNodeTextByPath("1\" & i) ' sets a string equal to the current node's text value
If Left(substring, 3) = "333" Then
If ActiveCell.Offset(0, 15).Value = "" Then
MsgBox ("yay")
Else
MsgBox ("whoah")
End If
Session.findById("wnd[0]/shellcont/shell").selectedNodeFullPath ("1\" & i) '** I can't get this line to select the current node
Session.findById("wnd[0]/tbar[1]/btn[14]").press ' deletes current node
End If
i = i + 1
Loop
I want to be able to select the current node within my while loop. How can I do this?
Thanks, Greg