| Vba - close all instances of internet explorer |
| Option Explicit |
| Sub IE_Sledgehammer() |
| Dim objWMI As Object, objProcess As Object, objProcesses As Object |
| Set objWMI = GetObject("winmgmts://.") |
| Set objProcesses = objWMI.ExecQuery( _ |
| "SELECT * FROM Win32_Process WHERE Name = 'iexplore.exe'") |
| For Each objProcess In objProcesses |
| Call objProcess.Terminate |
| Next |
| Set objProcesses = Nothing: Set objWMI = Nothing |
| End Sub |
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