| VBA to read text from an already open webpage |
| ' Determine if a specific instance of IE is already open. |
| Set objShell = CreateObject("Shell.Application") |
| IE_count = objShell.Windows.Count |
| For x = 0 To (IE_count - 1) |
| On Error Resume Next ' sometimes more web pages are counted than are open |
| my_url = objShell.Windows(x).Document.Location |
| my_title = objShell.Windows(x).Document.Title |
| 'You can use my_title of my_url, whichever you want |
| If my_title Like "Put your webpage title here" & "*" Then 'identify the existing web page |
| Set ie = objShell.Windows(x) |
| Exit For |
| Else |
| End If |
| Next |
VBA Reference to be added: VBA - UI Automation Project sample code Dim MyElement As UIAutomationClient.IUIAutomationElement Dim MyElement1 As UIAutomationClient.IUIAutomationElement 'Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Public Enum oConditions eUIA_NamePropertyId eUIA_AutomationIdPropertyId eUIA_ClassNamePropertyId eUIA_LocalizedControlTypePropertyId End Enum Sub Test() Dim AppObj As UIAutomationClient.IUIAutomationElement Dim oInvokePattern As UIAutomationClient.IUIAutomationInvokePattern Dim oAutomation As New CUIAutomation ' the UI Automation API\ Dim oPattern As UIAutomationClient.IUIAutomationLegacyIAccessiblePattern Set AppObj = WalkEnabledElements("BTB Portal 3.0 KA") Set MyElement = AppObj.FindFirst(TreeScope_Children, PropCon...
Comments
Post a Comment