oxylabs.io Open in urlscan Pro
2606:4700:10::6816:b8d  Public Scan

URL: https://oxylabs.io/blog/web-scraping-excel-vba
Submission: On January 17 via manual from IN — Scanned from DE

Form analysis 6 forms found in the DOM

<form>
  <fieldset>
    <legend class="visuallyhidden">Consent Selection</legend>
    <div id="CybotCookiebotDialogBodyFieldsetInnerContainer">
      <div class="CybotCookiebotDialogBodyLevelButtonWrapper"><label class="CybotCookiebotDialogBodyLevelButtonLabel" for="CybotCookiebotDialogBodyLevelButtonNecessary"><span
            class="CybotCookiebotDialogBodyLevelButtonDescription">Necessary</span></label>
        <div class="CybotCookiebotDialogBodyLevelButtonSliderWrapper CybotCookiebotDialogBodyLevelButtonSliderWrapperDisabled"><input type="checkbox" id="CybotCookiebotDialogBodyLevelButtonNecessary"
            class="CybotCookiebotDialogBodyLevelButton CybotCookiebotDialogBodyLevelButtonDisabled" disabled="disabled" checked="checked"> <span class="CybotCookiebotDialogBodyLevelButtonSlider"></span></div>
      </div>
      <div class="CybotCookiebotDialogBodyLevelButtonWrapper"><label class="CybotCookiebotDialogBodyLevelButtonLabel" for="CybotCookiebotDialogBodyLevelButtonPreferences"><span
            class="CybotCookiebotDialogBodyLevelButtonDescription">Preferences</span></label>
        <div class="CybotCookiebotDialogBodyLevelButtonSliderWrapper"><input type="checkbox" id="CybotCookiebotDialogBodyLevelButtonPreferences" class="CybotCookiebotDialogBodyLevelButton CybotCookiebotDialogBodyLevelConsentCheckbox"
            data-target="CybotCookiebotDialogBodyLevelButtonPreferencesInline" checked="checked" tabindex="0"> <span class="CybotCookiebotDialogBodyLevelButtonSlider"></span></div>
      </div>
      <div class="CybotCookiebotDialogBodyLevelButtonWrapper"><label class="CybotCookiebotDialogBodyLevelButtonLabel" for="CybotCookiebotDialogBodyLevelButtonStatistics"><span
            class="CybotCookiebotDialogBodyLevelButtonDescription">Statistics</span></label>
        <div class="CybotCookiebotDialogBodyLevelButtonSliderWrapper"><input type="checkbox" id="CybotCookiebotDialogBodyLevelButtonStatistics" class="CybotCookiebotDialogBodyLevelButton CybotCookiebotDialogBodyLevelConsentCheckbox"
            data-target="CybotCookiebotDialogBodyLevelButtonStatisticsInline" checked="checked" tabindex="0"> <span class="CybotCookiebotDialogBodyLevelButtonSlider"></span></div>
      </div>
      <div class="CybotCookiebotDialogBodyLevelButtonWrapper"><label class="CybotCookiebotDialogBodyLevelButtonLabel" for="CybotCookiebotDialogBodyLevelButtonMarketing"><span
            class="CybotCookiebotDialogBodyLevelButtonDescription">Marketing</span></label>
        <div class="CybotCookiebotDialogBodyLevelButtonSliderWrapper"><input type="checkbox" id="CybotCookiebotDialogBodyLevelButtonMarketing" class="CybotCookiebotDialogBodyLevelButton CybotCookiebotDialogBodyLevelConsentCheckbox"
            data-target="CybotCookiebotDialogBodyLevelButtonMarketingInline" checked="checked" tabindex="0"> <span class="CybotCookiebotDialogBodyLevelButtonSlider"></span></div>
      </div>
    </div>
  </fieldset>
</form>

<form><input type="checkbox" id="CybotCookiebotDialogBodyLevelButtonNecessaryInline" class="CybotCookiebotDialogBodyLevelButton CybotCookiebotDialogBodyLevelButtonDisabled" disabled="disabled" checked="checked"> <span
    class="CybotCookiebotDialogBodyLevelButtonSlider"></span></form>

<form><input type="checkbox" id="CybotCookiebotDialogBodyLevelButtonPreferencesInline" class="CybotCookiebotDialogBodyLevelButton CybotCookiebotDialogBodyLevelConsentCheckbox" data-target="CybotCookiebotDialogBodyLevelButtonPreferences"
    checked="checked" tabindex="0"> <span class="CybotCookiebotDialogBodyLevelButtonSlider"></span></form>

<form><input type="checkbox" id="CybotCookiebotDialogBodyLevelButtonStatisticsInline" class="CybotCookiebotDialogBodyLevelButton CybotCookiebotDialogBodyLevelConsentCheckbox" data-target="CybotCookiebotDialogBodyLevelButtonStatistics"
    checked="checked" tabindex="0"> <span class="CybotCookiebotDialogBodyLevelButtonSlider"></span></form>

<form><input type="checkbox" id="CybotCookiebotDialogBodyLevelButtonMarketingInline" class="CybotCookiebotDialogBodyLevelButton CybotCookiebotDialogBodyLevelConsentCheckbox" data-target="CybotCookiebotDialogBodyLevelButtonMarketing" checked="checked"
    tabindex="0"> <span class="CybotCookiebotDialogBodyLevelButtonSlider"></span></form>

<form class="CybotCookiebotDialogBodyLevelButtonSliderWrapper"><input type="checkbox" id="CybotCookiebotDialogBodyContentCheckboxPersonalInformation" class="CybotCookiebotDialogBodyLevelButton"> <span
    class="CybotCookiebotDialogBodyLevelButtonSlider"></span></form>

Text Content

Powered by Cookiebot
 * Consent
 * Details
 * [#IABV2SETTINGS#]
 * About


THIS WEBSITE USES COOKIES

We use cookies to personalise content and ads, to provide social media features
and to analyse our traffic. We also share information about your use of our site
with our social media, advertising and analytics partners who may combine it
with other information that you’ve provided to them or that they’ve collected
from your use of their services. You may find more detailed information about
your data processing here.

Consent Selection
Necessary

Preferences

Statistics

Marketing

Show details
Necessary 11

Necessary cookies help make a website usable by enabling basic functions like
page navigation and access to secure areas of the website. The website cannot
function properly without these cookies.
ClickCease
1
Learn more about this provider
cookietestThis cookie is used to determine if the visitor has accepted the
cookie consent box.
Expiry: SessionType: HTTP
Cookiebot
1
Learn more about this provider
CookieConsentStores the user's cookie consent state for the current domain
Expiry: 1 yearType: HTTP
Google
1
Learn more about this provider
test_cookieUsed to check if the user's browser supports cookies.
Expiry: 1 dayType: HTTP
LinkedIn
2
Learn more about this provider
bscookieThis cookie is used to identify the visitor through an application. This
allows the visitor to login to a website through their LinkedIn application for
example.
Expiry: 1 yearType: HTTP
li_gcStores the user's cookie consent state for the current domain
Expiry: 179 daysType: HTTP
oxylabs.io
5
debugThis cookie is used to detect errors on the website - this information is
sent to the website's support staff in order to optimize the visitor's
experience on the website.
Expiry: PersistentType: HTML
intercom.played-notificationsUsed by the website to determine which support
notifications the user has been shown.
Expiry: SessionType: HTML
landing_page_urlPending
Expiry: SessionType: HTML
productPending
Expiry: SessionType: HTML
referrerDetects how the user reached the website by registering their last
URL-address.
Expiry: SessionType: HTML
x.clearbitjs.com
1
pfjs%3AcookiesUsed to check if the user's browser supports cookies.
Expiry: 1 yearType: HTTP
Preferences 6

Preference cookies enable a website to remember information that changes the way
the website behaves or looks, like your preferred language or the region that
you are in.
Intercom
2
Learn more about this provider
intercom-id-#Allows the website to recoqnise the visitor, in order to optimize
the chat-box functionality.
Expiry: 270 daysType: HTTP
intercom-session-#Sets a specific ID for the user which ensures the integrity of
the website’s chat function.
Expiry: 6 daysType: HTTP
LinkedIn
3
Learn more about this provider
lang [x2]Remembers the user's selected language version of a website
Expiry: SessionType: HTTP
lidcRegisters which server-cluster is serving the visitor. This is used in
context with load balancing, in order to optimize user experience.
Expiry: 1 dayType: HTTP
oxylabs.io
1
intercom.intercom-state-#Remembers whether the user has minimized or closed
chat-box or pop-up messages on the website.
Expiry: PersistentType: HTML
Statistics 17

Statistic cookies help website owners to understand how visitors interact with
websites by collecting and reporting information anonymously.
Google
5
Learn more about this provider
collectUsed to send data to Google Analytics about the visitor's device and
behavior. Tracks the visitor across devices and marketing channels.
Expiry: SessionType: Pixel
_gaRegisters a unique ID that is used to generate statistical data on how the
visitor uses the website.
Expiry: 399 daysType: HTTP
_ga_#Used by Google Analytics to collect data on the number of times a user has
visited the website as well as dates for the first and most recent visit.
Expiry: 399 daysType: HTTP
_gatUsed by Google Analytics to throttle request rate
Expiry: 1 dayType: HTTP
_gidRegisters a unique ID that is used to generate statistical data on how the
visitor uses the website.
Expiry: 1 dayType: HTTP
LinkedIn
2
Learn more about this provider
AnalyticsSyncHistoryUsed in connection with data-synchronization with
third-party analysis service.
Expiry: 29 daysType: HTTP
ln_orRegisters statistical data on users' behaviour on the website. Used for
internal analytics by the website operator.
Expiry: 1 dayType: HTTP
Microsoft
5
Learn more about this provider
c.gifCollects data on the user’s navigation and behavior on the website. This is
used to compile statistical reports and heatmaps for the website owner.
Expiry: SessionType: Pixel
CLIDCollects data on the user’s navigation and behavior on the website. This is
used to compile statistical reports and heatmaps for the website owner.
Expiry: 1 yearType: HTTP
_clckCollects data on the user’s navigation and behavior on the website. This is
used to compile statistical reports and heatmaps for the website owner.
Expiry: 1 yearType: HTTP
_clskRegisters statistical data on users' behaviour on the website. Used for
internal analytics by the website operator.
Expiry: 1 dayType: HTTP
_cltkRegisters statistical data on users' behaviour on the website. Used for
internal analytics by the website operator.
Expiry: SessionType: HTML
Sleeknote
2
Learn more about this provider
https://#.#/Registers statistical data on users' behaviour on the website. Used
for internal analytics by the website operator.
Expiry: SessionType: Pixel
SNSSets a unique ID for the session. This allows the website to obtain data on
visitor behaviour for statistical purposes.
Expiry: SessionType: HTTP
Twitter Inc.
1
Learn more about this provider
personalization_idThis cookie is set by Twitter - The cookie allows the visitor
to share content from the website onto their Twitter profile.
Expiry: 399 daysType: HTTP
oxylabs.io
1
sn_global_countdown_last_reset_timestampSets a timestamp for when the visitor
entered the website. This is used for analytical purposes on the website.
Expiry: PersistentType: HTML
x.clearbitjs.com
1
cb%3AtestCollects data on the user's visits to the website, such as the number
of visits, average time spent on the website and what pages have been loaded
with the purpose of generating reports for optimising the website content.
Expiry: 1 yearType: HTTP
Marketing 32

Marketing cookies are used to track visitors across websites. The intention is
to display ads that are relevant and engaging for the individual user and
thereby more valuable for publishers and third party advertisers.
Meta Platforms, Inc.
1
Learn more about this provider
_fbpUsed by Facebook to deliver a series of advertisement products such as real
time bidding from third party advertisers.
Expiry: 3 monthsType: HTTP
Google
5
Learn more about this provider
IDEUsed by Google DoubleClick to register and report the website user's actions
after viewing or clicking one of the advertiser's ads with the purpose of
measuring the efficacy of an ad and to present targeted ads to the user.
Expiry: 1 yearType: HTTP
pagead/landing [x2]Collects data on visitor behaviour from multiple websites, in
order to present more relevant advertisement - This also allows the website to
limit the number of times that they are shown the same advertisement.
Expiry: SessionType: Pixel
ads/ga-audiencesUsed by Google AdWords to re-engage visitors that are likely to
convert to customers based on the visitor's online behaviour across websites.
Expiry: SessionType: Pixel
_gcl_auUsed by Google AdSense for experimenting with advertisement efficiency
across websites using their services.
Expiry: 3 monthsType: HTTP
LinkedIn
2
Learn more about this provider
bcookieUsed by the social networking service, LinkedIn, for tracking the use of
embedded services.
Expiry: 1 yearType: HTTP
UserMatchHistoryEnsures visitor browsing-security by preventing cross-site
request forgery. This cookie is essential for the security of the website and
visitor.
Expiry: 29 daysType: HTTP
Microsoft
9
Learn more about this provider
MUID [x2]Used widely by Microsoft as a unique user ID. The cookie enables user
tracking by synchronising the ID across many Microsoft domains.
Expiry: 1 yearType: HTTP
SRM_BTracks the user’s interaction with the website’s search-bar-function. This
data can be used to present the user with relevant products or services.
Expiry: 1 yearType: HTTP
ANONCHKRegisters data on visitors from multiple visits and on multiple websites.
This information is used to measure the efficiency of advertisement on websites.
Expiry: 1 dayType: HTTP
SMRegisters a unique ID that identifies the user's device during return visits
across websites that use the same ad network. The ID is used to allow targeted
ads.
Expiry: SessionType: HTTP
_uetsidCollects data on visitor behaviour from multiple websites, in order to
present more relevant advertisement - This also allows the website to limit the
number of times that they are shown the same advertisement.
Expiry: 1 dayType: HTML
_uetsid_expContains the expiry-date for the cookie with corresponding name.
Expiry: PersistentType: HTML
_uetvidUsed to track visitors on multiple websites, in order to present relevant
advertisement based on the visitor's preferences.
Expiry: 1 yearType: HTML
_uetvid_expContains the expiry-date for the cookie with corresponding name.
Expiry: PersistentType: HTML
Quora
1
Learn more about this provider
_/ad/75aa344edeef4dbfa3b3dd7cb5f40e6f/pixelCollects data on user behaviour and
interaction in order to optimize the website and make advertisement on the
website more relevant.
Expiry: SessionType: Pixel
Sleeknote
3
Learn more about this provider
_sn_aImplements pop-up advertisement on the website.
Expiry: 1 yearType: HTTP
_sn_mImplements pop-up advertisement on the website.
Expiry: 1 yearType: HTTP
_sn_nImplements pop-up advertisement on the website.
Expiry: 1 yearType: HTTP
Twitter Inc.
3
Learn more about this provider
i/adsct [x2]The cookie is used by Twitter.com in order to determine the number
of visitors accessing the website through Twitter advertisement content.
Expiry: SessionType: Pixel
muc_adsCollects data on user behaviour and interaction in order to optimize the
website and make advertisement on the website more relevant.
Expiry: 399 daysType: HTTP
prism.app-us1.com
2
prism_# [x2]Collects information on user preferences and/or interaction with
web-campaign content - This is used on CRM-campaign-platform used by website
owners for promoting events or products.
Expiry: 29 daysType: HTTP
x.clearbitjs.com
6
__tld__Used to track visitors on multiple websites, in order to present relevant
advertisement based on the visitor's preferences.
Expiry: SessionType: HTTP
cb_anonymous_idCollects data on visitor behaviour from multiple websites, in
order to present more relevant advertisement - This also allows the website to
limit the number of times that they are shown the same advertisement.
Expiry: 1 yearType: HTTP
cb_group_idCollects data on visitors. This information is used to assign
visitors into segments, making website advertisement more efficient.
Expiry: 1 yearType: HTTP
cb_group_propertiesCollects data on visitor behaviour from multiple websites, in
order to present more relevant advertisement - This also allows the website to
limit the number of times that they are shown the same advertisement.
Expiry: PersistentType: HTML
cb_user_idCollects data on visitor behaviour from multiple websites, in order to
present more relevant advertisement - This also allows the website to limit the
number of times that they are shown the same advertisement.
Expiry: 1 yearType: HTTP
cb_user_traitsCollects data on visitor behaviour from multiple websites, in
order to present more relevant advertisement - This also allows the website to
limit the number of times that they are shown the same advertisement.
Expiry: PersistentType: HTML
Unclassified 1
Unclassified cookies are cookies that we are in the process of classifying,
together with the providers of individual cookies.
Intercom
1
Learn more about this provider
intercom-device-id-f0htja21Pending
Expiry: 270 daysType: HTTP
Cross-domain consent[#BULK_CONSENT_DOMAINS_COUNT#] [#BULK_CONSENT_TITLE#]
List of domains your consent applies to: [#BULK_CONSENT_DOMAINS#]
Cookie declaration last updated on 07.01.23 by Cookiebot


[#IABV2_TITLE#]

[#IABV2_BODY_INTRO#]
[#IABV2_BODY_LEGITIMATE_INTEREST_INTRO#]
[#IABV2_BODY_PREFERENCE_INTRO#]
[#IABV2_LABEL_PURPOSES#]
[#IABV2_BODY_PURPOSES_INTRO#]
[#IABV2_BODY_PURPOSES#]
[#IABV2_LABEL_FEATURES#]
[#IABV2_BODY_FEATURES_INTRO#]
[#IABV2_BODY_FEATURES#]
[#IABV2_LABEL_PARTNERS#]
[#IABV2_BODY_PARTNERS_INTRO#]
[#IABV2_BODY_PARTNERS#]

Please state your consent ID and date when you contact us regarding your
consent.

Do not sell or share my personal information
Deny Customize Customize

Allow all cookies
Powered by Cookiebot by Usercentrics

Proxy locations

United States of America

United Kingdom

Japan

Canada

Germany

See all locations

Network statusCareers
hello@oxylabs.io

English (EN)

English

中文

Log in

ProxiesNEW

Residential Proxies

Residential Proxies

Human-like scraping without IP blocking

Mobile Proxies

Harness the power of IP addresses from real mobile devices

Rotating ISP Proxies

Extract the required data without the fear of getting blocked

Advanced Solutions

Web UnblockerNEW

AI-powered proxy solution for block-free scraping

Datacenter Proxies

Shared Datacenter Proxies

Fast and reliable proxies for cost-effective scraping

Dedicated Datacenter Proxies

The highest performing proxies on the market

SOCKS5 Proxies

Best for traffic-intensive scraping via UDP connection

Static Residential Proxies

Combined power of Datacenter and Residential IPs

Tools & Addons

Oxy Proxy Extension for Chrome

Free Chrome proxy manager extension that works with any proxy provider.

Oxy Proxy Manager for Android

Free Android proxy manager app that works with any proxy provider.

Proxy RotatorAdd-on

Rotates your Datacenter Proxies to help increase success rates.


Scraper APIs

Scraper APIs

SERP Scraper APIFREE TRIAL

Scalable SERP data delivery from major search engines

E-Commerce Scraper APIFREE TRIAL

Enterprise-level data from largest e-commerce marketplaces

Real Estate Scraper APIFREE TRIAL

Real-time data from popular real estate websites

Web Scraper APIFREE TRIAL

Public data delivery from a majority of websites


Pricing

Proxies

Shared Datacenter Proxies

Cost-effective solution

Starts from

$100/month

Dedicated Datacenter Proxies

Superior performance

Starts from

$180/month

Residential Proxies

Human-like scraping

Starts from

$15

Pay as you go

Mobile Proxies

4G proxies from mobile devices

Starts from

$500/month

Rotating ISP Proxies

Extended sessions

Starts from

$340/month

Web Unblocker

AI-powered proxy solution

Starts from

$325/month

Scraper APIs

SERP Scraper API

Scalable SERP data delivery

Starts from

$99/month

E-Commerce Scraper API

Enterprise-level product page data

Starts from

$99/month

Web Scraper API

Data from a majority of websites

Starts from

$99/month

Real Estate Scraper API

Real-time real estate data

Starts from

$99/month


Learn

Getting Started

Documentation

Integrations

FAQ

Knowledge Base

Blog

Read the latest articles about the world of web scraping, proxies, and more

Webinars

Check our webinars to learn more about data gathering issues and solutions

White papers

Get extensive white papers to understand the most complex scraping topics

Podcast

Listen to the podcast where our developers discuss web scraping in-depth

Scraping Experts

Watch lessons by industry-leading experts to gain insights on data gathering

Useful Information

Customer stories

GitHub

Quick Start Guides

Residential Proxies Quick Start Guide



Shared Datacenter Proxies Quick Start Guide



E-Commerce Scraper API Quick Start Guide



View all



Solutions

By Industry

E-Commerce

Get access to valuable e-commerce data with the help of advanced scraping
solutions

Cybersecurity

Collect threat intelligence and inspect risky activities anonymously with
reliable proxies

Brand protection

Monitor the web on a large scale to ensure no unauthorized product seeped into
the market

By Use Case

Price Monitoring

Travel Fare Aggregation

SEO Monitoring

Ad Verification

Alternative Data

View all



Sign upContact sales
Sign up


Back to blog

TutorialsScrapers


GUIDE TO EXTRACTING WEBSITE DATA BY USING EXCEL VBA

Yelyzaveta Nechytailo

2022-10-19

5 min read
Share

Microsoft Excel is undoubtedly one of the most used software applications around
the world and across various disciplines. It not only stores, organizes, and
manipulates the data using different functions and formulas but also allows
users to access web pages and extract data from them.

In this tutorial, we are going to focus on the last mentioned feature by
demonstrating how to perform Excel web scraping using VBA. We will briefly go
through the installation and preparation of the environment and then write a
scraper using VBA macro to successfully fetch data from a web page into Excel.
Let’s get started.


WHAT IS VBA WEB SCRAPING?

VBA web scraping is a special scraping technique that allows for automatic data
gathering from websites to Excel. The scraping itself becomes possible with the
use of such external applications like Microsoft Edge browser.

What is VBA?

VBA stands for Visual Basic Application. It is a programming language of
Microsoft Corporation. VBA extends the capabilities of Microsoft Office tools
and allows users to develop advanced functions and complex automation. VBA can
also be used to write macros to pull data from websites into Excel.


PROS AND CONS OF USING VBA FOR SCRAPING

Before we move on to the tutorial part it is essential to highlight some
advantages and disadvantages of web scraping to Excel with VBA.


PROS

 * Ready to use – VBA is bundled with Microsoft Office which basically means
   that if you already have MS Office installed, you don’t have to worry about
   installing anything else. You can use VBA right away in all the Microsoft
   Office tools.

 * Reliable – Both Microsoft Excel & VBA are developed and maintained by
   Microsoft. Unlike other development environments, these tools can be upgraded
   together to the latest version without much hassle.

 * Out-of-the-box support for browser – VBA web scrapers can take advantage of
   Microsoft’s latest browser Microsoft Edge which makes scraping dynamic
   websites pretty convenient.  

 * Complete automation – When running the VBA script, you don’t have to perform
   any additional tasks or interact with the browser. Everything will be taken
   care of by the VBA script including log-in, scrolling, button clicks, etc.


CONS

 * Only works in Windows – VBA scrapers are not cross-platform. They only work
   in a Windows environment. While MS Office does have support for Mac, it is
   way harder to write a working VBA scraper on it. The library supports are
   also limited, for example, you will be unable to use Microsoft Edge.

 * Tightly coupled with MS Office – VBA scrapers are highly dependent on MS
   Office tools. Third-party useful scraping tools are hard to integrate with
   it.

 * Steep learning curve - VBA programming language is less beginner-friendly and
   a bit harder than other modern programming languages, such as Python or
   Javascript.

Overall, if you are looking to develop a web scraper for the Windows operating
system that automatically pulls data from a website, then VBA-based web scraping
will be a good choice.


TUTORIAL

Before we begin, let us make sure we’ve installed all the prerequisites and set
up our environment properly so that it will be easier to follow along.


PREREQUISITES

In this tutorial, we’ll be using Windows 10 and Microsoft Office 10. However,
the steps will be the same or similar for other versions of Windows. You’ll only
need a computer with Windows Operating System. In addition, it’s necessary to
install Microsoft Office if you don’t have it already. Detailed installation
instructions can be found in the Microsoft’s Official documentation.


PREPARING THE ENVIRONMENT

Now, that you’ve installed MS Office, complete the steps below to set up the
development environment:


STEP 1 - OPEN MICROSOFT EXCEL

From the start menu or Cortana search, find Microsoft Excel and open the
application. You will see a similar interface as below: 

Click on File 




STEP 2 - GO TO OPTIONS TO ENABLE DEVELOPER MENU

By default, Excel doesn’t show the developer button in the top ribbon. To enable
this, we’ll have to go to “Options” from the File menu.




STEP 3 -  SELECT CUSTOMIZE RIBBON

Once you click the “Options,” a dialog will pop up where, from the side menu,
you’ll need to select “Customize Ribbon”. Click on the check box next to
“developer.” Make sure it is ticked and then click on “OK.”




STEP 4 - OPEN VISUAL BASIC APPLICATION DIALOG

Now, you’ll see a new developer button on the top ribbon, clicking on it will
expand the developer menu. From the menu, select “Visual Basic.”




STEP 5 - INSERT A NEW MODULE

Once you click on “Visual Basic", it will open a new window as demonstrated
below:



Click on “Insert” and select “Module” to insert a new module. It will open the
module editor.




STEP 6 - ADD NEW REFERENCES

From the top menu select Tools >  References… which will open a new window like
the one below. Make sure to scroll through the available list of references and
find Microsoft HTML Client Library and Microsoft Internet Control. Click on the
check box next to both of them to enable these references. Once done, click OK.



That’s it! Our development environment is all set. Let’s write our first Excel
VBA scraper.


STEP 7 - AUTOMATE MICROSOFT EDGE TO OPEN A WEBSITE

Now, it’s time to update our newly created module to open the following website:
https://quotes.toscrape.com. In the module editor, insert the following code:

Sub scrape_quotes()
   Dim browser As InternetExplorer
   Dim page As HTMLDocument
   Set browser = New InternetExplorer
   browser.Visible = True
   browser.navigate ("https://quotes.toscrape.com")
End Sub

We are defining a subroutine named scrape_quotes(). This function will be
executed when we run this script. Inside the subroutine, we are defining two
objects “browser” and  “page”. 

The “browser” object will allow us to interact with Microsoft Edge. Next, we
also set the browser as visible so that we can see it in action. The
browser.navigate() function tells the VBA browser object to open the URL. The
output will be similar to this:



Note: You might be wondering why we are writing “InternetExplorer” to interact
with Microsoft Edge. VBA initially only supported Internet Explorer-based
automation, but once Microsoft discontinued Internet Explorer, they deployed
some updates so that VBA’s InternetExplorer module can run the Microsoft Edge
browser in IEMode without any issues. The above code will also work in older
Windows that have Internet Explorer still available instead of Edge. 


STEP 8 - SCRAPE DATA USING VBA SCRIPT AND SAVE IT TO EXCEL

The next step is to scrape the quotes and authors from the website. For
simplicity, we’ll store it in the first sheet of the Excel spreadsheet and grab
the top 5 quotes for now.

Let’s begin by defining two new objects – one for quotes and another for
authors.

   Dim quotes As Object
   Dim authors As Object

After navigating to the website, we’ll also add a little bit of pause so that
the website loads properly by using Loop.

   Do While browser.Busy: Loop

Next, grab the quotes and authors from the HTML document.

   Set page = browser.document
   Set quotes = page.getElementsByClassName("quote")
   Set authors = page.getElementsByClassName("author")

Use a for loop to populate the excel rows with the extracted data by calling the
Cells function and passing the row and column position:

   For num = 1 To 5
       Cells(num, 1).Value = quotes.Item(num).innerText
       Cells(num, 2).Value = authors.Item(num).innerText
   Next num

Finally, close the browser by calling the quit function. The below code will
close the browser window.

   browser.Quit


OUTPUT

Now, if we run the script again, it’ll open Microsoft Edge, browse to the
quotes.toscrape.com website, grab the top 5 quotes from the list, and save them
to the current excel file’s first sheet.




SOURCE CODE

Below is an example of a full source code:

Sub scrape_quotes()
   Dim browser As InternetExplorer
   Dim page As HTMLDocument
   Dim quotes As Object
   Dim authors As Object
  
   Set browser = New InternetExplorer
   browser.Visible = True
   browser.navigate ("https://quotes.toscrape.com")
   Do While browser.Busy: Loop
  
   Set page = browser.document
   Set quotes = page.getElementsByClassName("quote")
   Set authors = page.getElementsByClassName("author")
  
   For num = 1 To 5
       Cells(num, 1).Value = quotes.Item(num).innerText
       Cells(num, 2).Value = authors.Item(num).innerText
   Next num
  
   browser.Quit
End Sub


CONCLUSION

Excel web scraping with VBA is a great choice for Windows automation and web
extraction. It’s reliable and ready to use which means you won’t have to worry
about any unexpected issues or additional steps. For your convenience, you can
also access this tutorial in our GitHub repository. 

The biggest disadvantage of VBA web scraping that was highlighted in the article
is the lack of cross-platform support. However, if you want to develop web
scrapers that can be used on multiple operating systems such as Linux or Mac,
Excel Web Query can also be an option. Of course, we also recommend exploring
web scraping with Python – one of the most popular programming languages that is
capable of developing complex network applications while maintaining its
simplified syntax. 

About the author

Yelyzaveta Nechytailo

Content Manager

Yelyzaveta Nechytailo is a Content Manager at Oxylabs. After working as a writer
in fashion, e-commerce, and media, she decided to switch her career path and
immerse in the fascinating world of tech. And believe it or not, she absolutely
loves it! On weekends, you’ll probably find Yelyzaveta enjoying a cup of matcha
at a cozy coffee shop, scrolling through social media, or binge-watching
investigative TV series.

Learn more about Yelyzaveta Nechytailo



All information on Oxylabs Blog is provided on an "as is" basis and for
informational purposes only. We make no representation and disclaim all
liability with respect to your use of any information contained on Oxylabs Blog
or any third-party websites that may be linked therein. Before engaging in
scraping activities of any kind you should consult your legal advisors and
carefully read the particular website's terms of service or receive a scraping
license.

TutorialsData acquisition

WEB UNBLOCKER QUICK START GUIDE

Discover the essentials of Web Unblocker and learn how to get started with it.

Vytenis Kaubre

2023-01-02

TutorialsScrapers

REAL ESTATE SCRAPER API QUICK START GUIDE

Real Estate Scraper API is a powerful tool for real estate real-time data
collection at scale from almost any target. Learn how the tool works and jump
straight to your first scraping task.

Augustas Pelakauskas

2022-11-23

TutorialsData acquisition

GUIDE TO SCRAPING DATA FROM WEBSITES TO EXCEL WITH WEB QUERY

Check this step-by-step tutorial to learn how to scrape data from websites into
Excel. Find out Excel's capabilities of extracting information from various
websites.

Iveta Vistorskyte

2022-11-10

Get the latest news from data gathering world

I'm interested

IN THIS ARTICLE:

 * --------------------------------------------------------------------------------
   
   What is VBA web scraping?

 * --------------------------------------------------------------------------------
   
   Pros and cons of using VBA for scraping

 * --------------------------------------------------------------------------------
   
   Tutorial

 * --------------------------------------------------------------------------------
   
   Output

 * --------------------------------------------------------------------------------
   
   Source Code

 * --------------------------------------------------------------------------------
   
   Conclusion

Scale up your business with Oxylabs®

RegisterContact sales

--------------------------------------------------------------------------------

GET IN TOUCH

 * General:
   
   hello@oxylabs.io

 * Support:
   
   support@oxylabs.io

 * Career:
   
   career@oxylabs.io

Certified data centers and upstream providers



English中文

Connect with us

 * 
 * 
 * 
 * 

Company

 * About us
 * Our values
 * Affiliate program
 * Service partners
 * Press area
 * Residential Proxies sourcing
 * Careers
 * Our products
 * OxyCon
 * Project 4beta

Proxies

 * Datacenter Proxies
 * Shared Datacenter Proxies
 * Dedicated Datacenter Proxies
 * Residential Proxies
 * Static Residential Proxies
 * SOCKS5 Proxies
 * Mobile Proxies
 * Rotating ISP Proxies

Advanced proxy solutions

 * Web Unblocker

Top locations

 * United States
 * United Kingdom
 * Canada
 * Germany
 * India
 * All locations

Resources

 * FAQ
 * Documentation
 * Blog

Scraper APIs

 * SERP Scraper API
 * E-Commerce Scraper API
 * Real Estate Scraper API
 * Web Scraper API

Innovation hub

 * Adaptive Parser
 * Oxylabs' Patents

--------------------------------------------------------------------------------

Privacy Policy

Trust & Safety

Vulnerability Disclosure Policy


oxylabs.io© 2023 All Rights Reserved






word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word word word word word word word word word
word word word word word word word word

mmMwWLliI0fiflO&1
mmMwWLliI0fiflO&1
mmMwWLliI0fiflO&1
mmMwWLliI0fiflO&1
mmMwWLliI0fiflO&1
mmMwWLliI0fiflO&1
mmMwWLliI0fiflO&1