VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Tabelle1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
'-Begin-----------------------------------------------------------------
Option Explicit
Dim gColl() As Coll
Dim j As Integer
Sub GetAll(Obj As Object) '---------------------------------------------
'-
'- Recursively called sub routine to get the information of all SAP GUI
'- elements
'-
'-----------------------------------------------------------------------
Dim cntObj As Integer
Dim i As Integer
Dim Child As Object
On Error Resume Next
cntObj = Obj.Children.Count()
If cntObj > 0 Then
For i = 0 To cntObj - 1
Set Child = Obj.Children.Item(CLng(i))
GetAll Child
ReDim Preserve gColl(j)
gColl(j).ID = CStr(Child.ID)
gColl(j).Text = CStr(Child.Text)
gColl(j).Type = CStr(Child.Type)
gColl(j).Name = CStr(Child.Name)
j = j + 1
Next
End If
On Error GoTo 0
End Sub
Sub StartGetAll(ConnNo As Integer, SessNo As Integer) '-----------------
'-
'- Sub routine to get all UI elements of the SAP GUI for Windows
'-
'-----------------------------------------------------------------------
Dim SapGuiAuto As Object
Dim app As SAPFEWSELib.GuiApplication
Dim connection As SAPFEWSELib.GuiConnection
Dim session As SAPFEWSELib.GuiSession
Dim i As Integer
Set SapGuiAuto = GetObject("SAPGUI")
If Not IsObject(SapGuiAuto) Then
Exit Sub
End If
Set app = SapGuiAuto.GetScriptingEngine
If Not IsObject(app) Then
Exit Sub
End If
Set connection = app.Children(ConnNo)
If Not IsObject(connection) Then
Exit Sub
End If
If connection.DisabledByServer = True Then
Exit Sub
End If
Set session = connection.Children(SessNo)
If Not IsObject(session) Then
Exit Sub
End If
If session.Info.IsLowSpeedConnection = True Then
Exit Sub
End If
GetAll session
Cells(1, 1) = "ID"
Cells(1, 2) = "Text"
Cells(1, 3) = "Type"
Cells(1, 4) = "Name"
For i = LBound(gColl) To UBound(gColl)
Cells(i + 2, 1) = gColl(i).ID
Cells(i + 2, 2) = gColl(i).Text
Cells(i + 2, 3) = gColl(i).Type
Cells(i + 2, 4) = gColl(i).Name
Next
Columns("A:D").AutoFit
End Sub
Sub Start() '-----------------------------------------------------------
StartGetAll 0, 0
End Sub
'-End-------------------------------------------------------------------