This article will teach you about how you can perform a google search on Internet Explorer using Microsoft Excel.
Step 1: Create a user form and place one listbox and Web Browser as shown below: To get the Web browser control in toolbox follow below steps: Right click on toolbox. Select additional control (refer below screenshot 1.1) Select Microsoft Web Browser control from the list of controls (refer below screenshot 1.2) Check and OK.
VBA macro drives internet explorer using its DOM properties and methods. The macro allows to interact with web page controls (text fields and buttons). The example opens web site www.excely.com and fill a search form to find 'excel vba' text. First we open manually web site and found html-code of search form. Microsoft HTML Library: offers various object to hold and manipulate HTML controls available on a web page like TextBox, List, Combobox, Table, Popups etc. Microsoft Internet Controls: has capability to deal with Internet Windows like resize, minimize, maximize, open, close etc. How to Login to Website Using VBA. Here is a simple code that will login to Google accounts with the provided user-name and password. Microsoft HTML Object Library. The Internet control is used to browse the webpage and the HTML Objects are used to identify the username and password textboxes and submit the text using the control button. In the below window, scroll down and choose “ Microsoft Internet Controls.”. Step 3: Check the box of “Microsoft Internet Controls” and click on Ok. Now we should see this object name in the IntelliSense list. Step 4: Choose “InternetExplorer.”. Step 5: Next, we need to set the reference to enable Internet Explorer.
Steps:
- Create the object of Shell Application
- Get all the windows using shellobject.Windows
- Navigate all the windows
- check if window is Internet Explorer.
- if window is IE then check if it is Google Search browser and store the object
- Get the Page object of Google Search window.
- Identify the objects on the Page using “GetElementById” and “getElementsByName”
- Put the search text
- Wait for 3-4 secs
- Click the Search button
Create the object of Shell Application
Set objShell = CreateObject(“Shell.Application”)
Get all the windows using shellobject.Windows
Set objAllWindows = objShell.Windows
Navigate all the windows
For Each ow In objAllWindows
check if window is Internet Explorer
If (InStr(1, ow, “Internet Explorer”, vbTextCompare)) Then
if window is IE then check if it is Google Search browser and store the object
If (InStr(1, ow.locationURL, “www.google.”, vbTextCompare)) Then
Set objGoogle = ow
End If
Get the Page object of Google Search window.
Set objPage = objGoogle.Document
Identify the objects on the Page using “GetElementById” and “ getElementsByName” Trials in tainted space unlock planets.
Set SearchEditB = objPage.getElementByID(“gbqfq”)
Set Search = objPage.getElementsByName(“btnG”)
Office 2019 auf windows 7. Nfs most wanted 2005 full hd patch. Put the search text
SearchEditB.Value = “Excel macro Sumit Jain”
Wait for 3-4 secs
Excel Vba Microsoft Internet Controls Reference
FnWait (5)
Click the Search button
Excel Vba Microsoft Internet Controls Windows 10
Search(0).Click
Excel Vba Microsoft Internet Controls
Excel Vba Microsoft Internet Controls Diagram
Complete Code: