Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hWnd As Long) As Long
Sub ie_test_ExecWB() Dim objIE As Object Set objIE = CreateObject("InternetExplorer.application") objIE.Visible = True objIE.Navigate "google.com" Do While objIE.Busy = True DoEvents Loop
If SetForegroundWindow(objIE.hWnd) Then SendKeys "+{TAB}^a^c", True End If Set objIE = Nothing
Range("A1").Select ActiveSheet.PasteSpecial Format:="HTML" End Sub