on 03-28-2016 3:02 PM
I am using excel/vba to control the SAP GUI. I want to know if session.findById("wnd[0]/usr/subSUB_ITEM:SAPMZIWB:0945/tabsTS_ITEM/tabpSENO") is the currently selected tab. I found that its parent session.findById("wnd[0]/usr/subSUB_ITEM:SAPMZIWB:0945/tabsTS_ITEM") has a .SelectedTab property or method. I tried using it but Debug.Print session.findById("wnd[0]/usr/subSUB_ITEM:SAPMZIWB:0945/tabsTS_ITEM").SelectedTab Is giving me "Run-time error '438': Object doesn't support this property or method" So I am kind of stuck here. I can use session.findById("wnd[0]/usr/subSUB_ITEM:SAPMZIWB:0945/tabsTS_ITEM/tabpSENO").select to force select this tab but I would rather just read which is the currently selected tab. If anyone has advice I would appreciate it. Here is some of my code that could be useful to others. I have this DumpProperties function. Public Sub DumpProperties(o As Object) Dim t As TLI.TLIApplication Set t = New TLI.TLIApplication Dim ti As TLI.TypeInfo Set ti = t.InterfaceInfoFromObject(o) Dim mi As TLI.MemberInfo, i As Long For Each mi In ti.Members i = i + 1 Debug.Print mi.Name Next Debug.Print TypeName(o) End Sub It gives all the properties and methods of an object. Object type is GuiTab or ISapTabTarget Debug.Print session.findById("wnd[0]/usr/subSUB_ITEM:SAPMZIWB:0945/tabsTS_ITEM/tabpSENO").Type GuiTab Debug.Print TypeName(session.findById("wnd [0]/usr/subSUB_ITEM:SAPMZIWB:0945/tabsTS_ITEM/tabpSENO")) ISapTabTarget DumpProperties session.findById("wnd[0]/usr/subSUB_ITEM:SAPMZIWB:0945/tabsTS_ITEM/tabpSENO") Name Type TypeAsNumber ContainerType Id Parent Text Left Top Width Height ScreenLeft ScreenTop Tooltip Changeable Modified IconName AccTooltip AccLabelCollection AccText AccTextOnRequest ParentFrame IsSymbolFont DefaultTooltip Children SetFocus Visualize DumpState ShowContextMenu FindById FindByName FindByNameEx FindAllByName FindAllByNameEx Select ScrollToLeft The parent object is type GuiTabStrip or ISapTabbedPane DumpProperties session.findById("wnd[0]/usr/subSUB_ITEM:SAPMZIWB:0945/tabsTS_ITEM") Name Type TypeAsNumber ContainerType Id Parent Text Left Top Width Height ScreenLeft ScreenTop Tooltip Changeable Modified IconName AccTooltip AccLabelCollection AccText AccTextOnRequest ParentFrame IsSymbolFont DefaultTooltip Children LeftTab SelectedTab CharLeft CharTop CharWidth CharHeight SetFocus Visualize DumpState ShowContextMenu FindById FindByName FindByNameEx FindAllByName FindAllByNameEx ISapTabbedPane BTW I am connecting to the SAP session with this, not pretty but it works. I past it in every function because I haven't made a way to maintain a "global" connection. If Not IsObject(MyApplication) Then Set SapGuiAuto = GetObject("SAPGUI") Set MyApplication = SapGuiAuto.GetScriptingEngine End If If Not IsObject(Connection) Then Set Connection = MyApplication.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
moderators please delete this thread
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, the formatting was lost, this is unreadable I will post again. Why doesn't copy & paste work in this editor ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.