Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To capture a webpage from Excel or Access VBA, automate a real browser: navigate to the URL, wait for the page to render, then save a screenshot from a WebDriver-based VBA wrapper. A screenshot captures what the browser displays; downloading the URL’s HTML or saving a workbook as HTML does not. The example below uses the third-party SeleniumBasic wrapper and captures the browser’s current window, not necessarily the entire page.

Choose the right capture method

A webpage screenshot must come from a rendered browser. WebDriver lets a separate program control browser behavior, while a VBA wrapper gives VBA a way to invoke browser automation. These are distinct components: the browser, its matching driver, and the automation framework or wrapper.

  • Current-window screenshot: captures what is in the browser window. It may not include content below the visible area.
  • Element screenshot: captures a particular element, such as a chart or report section, if the element is within the captured image.
  • Full-page screenshot: includes content beyond the viewport. Do not assume a current-window capture or the SeleniumBasic methods described here produce one.

If you need a full-page image, verify that your chosen browser automation library and version supports that capture mode. A workaround that scrolls and stitches images is a separate implementation and can produce seams or miss sticky and lazy-loaded content.

Prepare Edge, WebDriver, and the VBA wrapper

Microsoft’s Edge WebDriver guidance describes three separate pieces: Microsoft Edge, Microsoft Edge WebDriver, and a WebDriver testing framework. For that documented Edge setup, the first three components of the four-part Edge and WebDriver version numbers must match. Microsoft also specifies Selenium 4 for Edge automation with Selenium; Selenium Tools for Microsoft Edge is not needed when using Selenium 4. These requirements can change, so check Microsoft’s current Edge WebDriver documentation before setting up a machine.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

That guidance does not provide a native VBA binding. SeleniumBasic is a third-party VBA-facing wrapper whose source exposes screenshot methods. The available documentation does not establish that it is Microsoft-supported or currently maintained. Confirm that the wrapper and your browser/driver combination work in your environment before relying on the macro for unattended jobs. Selenium’s official documentation also provides screenshot examples for its supported language bindings, but those examples are not themselves a VBA setup guide.

  1. Install a browser you can automate and the matching WebDriver executable. For Edge, check the version-matching requirements in Microsoft’s documentation.
  2. Install and register the VBA-facing wrapper you plan to use. In the VBA editor, check Tools > References for the wrapper’s available type library if its installation requires one.
  3. In the VBA editor, use Insert > Module to add a standard module and paste the macro below.
  4. Set the URL and output path to locations you can access, then run CaptureCurrentWindow.

Because wrapper installations and browser support differ, treat the code as an example of the SeleniumBasic API shape, not a Microsoft-provided or independently verified end-to-end macro. If your installed wrapper does not expose the same names or browser startup behavior, consult its documentation and adjust those calls rather than assuming the Edge WebDriver setup alone supplies a VBA API.

Capture and save a browser-window screenshot

This example uses SeleniumBasic’s current-window screenshot method and saves a PNG. The optional delay is expressed in milliseconds. It is a basic settling delay, not proof that a dynamic page has finished loading.

Option Explicit

Public Sub CaptureCurrentWindow()
    Dim driver As New WebDriver
    Dim pageUrl As String
    Dim outputPath As String

    pageUrl = "https://example.com/"
    outputPath = "C:\Temp\page-shot.png"

    On Error GoTo CaptureError

    ' Start the browser supported by your installed SeleniumBasic setup.
    driver.Start "chrome"
    driver.Get pageUrl

    ' Basic settling delay in milliseconds; increase or replace with
    ' a condition-based wait for pages that load content asynchronously.
    Application.Wait Now + TimeSerial(0, 0, 3)

    driver.TakeScreenshot.SaveAs outputPath, ssPNG

    driver.Quit
    MsgBox "Screenshot saved to " & outputPath, vbInformation
    Exit Sub

CaptureError:
    On Error Resume Next
    driver.Quit
    On Error GoTo 0
    MsgBox "Screenshot failed: " & Err.Description, vbExclamation
End Sub

Replace the browser name with one supported by your installed wrapper. The path shown is a Windows example; make sure its folder exists and that Excel has permission to write there. If the wrapper accepts a different screenshot save signature or image-format constant, use the syntax for that installed version.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Wait for the page you actually need

A successful navigation call does not guarantee that a modern page’s charts, images, or data have finished rendering. A fixed pause is simple but brittle: a slow connection can outlast it, while a fast page wastes time waiting. Prefer waiting for a meaningful page condition—such as a report container or result element—when the wrapper supports condition-based waits. The SeleniumBasic screenshot source documents the capture behavior, but does not establish a universal wait recipe for every site.

For a page with lazy-loaded images, the screenshot can omit images that have not been triggered by scrolling. If your goal is to capture the whole report rather than the initial view, first confirm both that your library can capture the required area and that the relevant content has loaded.

Capture a specific element instead

SeleniumBasic also exposes element screenshot behavior. Locate the element using the wrapper’s element-finding API, then call its screenshot save method using the installed version’s supported syntax. The wrapper source describes obtaining a screenshot and cropping it to the element rectangle when native element screenshot support is unavailable. If the element’s rectangle falls outside the screenshot, the implementation can raise an error.

That means an element must be in the captured region. Scroll it into view before capturing if the wrapper supports scrolling, and handle the possibility that a responsive layout or late-loading content moved it. Element capture is useful for a visible card, chart, or table; it is not a substitute for full-page capture when the target extends beyond the viewport.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep legacy browser controls separate

Older Excel and Access examples may use the Internet Explorer WebBrowser control. Microsoft’s legacy guidance explains that navigation is asynchronous: code that reads the page immediately after calling navigation can run before loading is complete. The Internet Explorer DocumentComplete event can fire for each frame in a framed page, not just once for the top-level document. Legacy event handlers therefore need to identify the relevant completion before acting.

This is historical context, not a recommendation to build a new capture workflow around Internet Explorer. Access also has an EdgeBrowserControl based on Edge WebView2, with a ControlSource for the webpage and an ExecuteJavascript method. That is Access-specific; its reference does not establish a general Excel control or a screenshot method.

Do not confuse a screenshot with Excel’s HTML export

ActiveWorkbook.SaveAs with FileFormat:=xlHTML exports workbook content as an HTML document and supporting files. It does not open an external webpage in a browser and capture its appearance. Use browser automation for a rendered webpage screenshot; use the workbook HTML export when the goal is to publish spreadsheet content as HTML.

Or skip the browser setup

If you do not want to install and coordinate a browser, driver, and VBA wrapper, ScreenshotNeo offers a screenshot API and MCP server. One GET request returns an image or PDF. Its clean-shot steps accept cookie/consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. AI agents can use its MCP server tools, including take_screenshot, get_page_info, and capture_pdf.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Here is the cURL call; replace the key and target URL. See the ScreenshotNeo API documentation for options such as output format and viewport.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo includes 1,000 screenshots per month on its free plan with no card; paid plans start at $5 for 3,000 screenshots. Sign up for free and try 1,000 screenshots a month with no card.

Best Value
Sale
The Microsoft Office 365 Bible: The Most Updated and Complete Guide to Excel, Word, PowerPoint, Outlook, OneNote, OneDrive, Teams, Access, and Publisher from Beginners to Advanced
  • The Microsoft Office 365 Bible: The Most Updated and Complete Guide to Excel, Word, PowerPoint, Outlook, OneNote, OneDrive, Teams, Access, and Publisher from Beginners to Advanced
  • ABIS BOOK
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting VBA screenshot failures

  • VBA says “User-defined type not defined” for WebDriver: the VBA-facing wrapper is missing, not registered, or its reference is unavailable. Install/register the intended wrapper and check Tools > References; the Microsoft Edge WebDriver setup does not add a VBA binding by itself.
  • The browser fails to start or WebDriver reports a session/version error: confirm the browser and driver are installed and compatible. For Microsoft’s Edge guidance, the first three version components must match; Selenium users need Selenium 4.
  • The output file is missing: verify that the destination folder exists, that the path is valid, and that the process has write access. Use an absolute path while debugging.
  • The screenshot shows a spinner, blank section, or incomplete page: navigation may have returned before asynchronous content was ready. Wait for the actual target condition where supported, and investigate whether the site requires authentication or delays rendering.
  • An element screenshot raises an out-of-bounds error: the element rectangle may be outside the screenshot. Bring it into the visible region and ensure the page has settled before capture.
  • The image ends at the viewport: the method captured the current browser window. Use a verified full-page capture capability or implement a separate scroll-and-stitch process if the whole document is required.
  • A legacy WebBrowser macro runs too early or multiple times: navigation is asynchronous and completion events may be raised for frames. Filter for the top-level document and avoid treating the first event as universal completion.

Reliability and cost considerations

A local WebDriver workflow makes browser startup, navigation, waiting, and file output your responsibility. Its runtime depends on the page, machine, network, driver, and chosen waits; the available documentation does not establish a general performance figure. For recurring captures, log the requested URL, time, output path, and errors, and always close browser sessions on both success and failure. For pages that change often, validate the captured result rather than assuming that a saved file contains the intended content.

ScreenshotNeo instead prices by plan: Free includes 1,000 monthly shots with no card; Starter is $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000. Yearly billing gives two months free, and every feature is on every plan. Check the current service page for current terms before choosing a plan.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can I capture a webpage from Excel VBA without opening a browser?

Not with the browser-automation method shown: it relies on a rendered browser session. An API can perform the capture remotely instead, as in the ScreenshotNeo example above.

Does the SeleniumBasic current-window screenshot include the entire webpage?

No full-page capability is established for that method. It captures the current window; content outside the captured image may be absent.

Can I use the Access EdgeBrowserControl in an Excel VBA macro?

No. The referenced EdgeBrowserControl is an Access control, not a general Excel VBA control.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.