Home Excel Powerpoint Word Outlook Error Codes

VBA Useful Codes

Welcome to the World of VBA
Home > VBAUsefulCodes

Open Internet Explorer from Excel VBA

Automate internet explorer based tasks from excel. A sample code automatically searches a specific string in google in internet explorer.

Dim objWindow As Object
Dim objIEApp As Object
Dim objShell As Object
Dim objItem As Object
On Error GoTo Fin
strTMP = "VBA Useful Codes Android App DP Technology Solutions"
Set objShell = CreateObject("Shell.Application")
Set objWindow = objShell.Windows()
For Each objItem In objWindow
If LCase(objItem.FullName Like "*iexplore*") Then
Set objIEApp = objItem
End If
Next objItem
If objIEApp Is Nothing Then
Set objIEApp = CreateObject("InternetExplorer.Application")
objIEApp.Visible = True
End If
With objIEApp
.Visible = True
.Navigate "http://www.google.com"
While Not .ReadyState = 4
.Document.all.q.Value = strTMP
End With
If Err.Number <> 0 Then MsgBox "Error: " & _
Err.Number & " " & Err.Description
Set objWindow = Nothing
Set objShell = Nothing
End Sub


Enter your e-mail below and get notified on the latest blog posts.


VBA Outlook KPI Excel Alt+F11 Dashboards Macros Recording Graphs Automation Developer WaterFall Powerpoint Charts Pivot Tables Forecast Charts

Follow Us