Others

How to Open a Website URL from Microsoft Access VBA

Maira MehtabMaira Mehtab Oct 21, 2026 869 views

Question details

The user needs to know how to launch a web browser link directly using VBA in Microsoft Access without assigning the URL to a form control's HyperlinkPart property.

How to Open a Website URL from Microsoft Access VBA
Product
Microsoft Access
Device & OS
not provided
Scenario
Executing a VBA script within a Microsoft Access application to open a specific website in the user's default external web browser.
Observed behavior
The user wants to programmatically trigger the default web browser to open a URL using a VBA macro or script.
Before you start

Ensure you have a complete, valid URL (including the http:// or https:// prefix) ready to test in your VBA script and verify that macros are enabled in your Access database.

Solution 1Recommended

Use the Application.FollowHyperlink Method

This is the most reliable and standard approach to open a URL in the system's default web browser directly from Access VBA.

The FollowHyperlink method passes the URL string to the operating system, which then opens it using the default application registered for web links.

1
Open the VBA Editor

Open your Microsoft Access database and press ALT + F11 to launch the Visual Basic for Applications (VBA) Editor.

2
Insert or select a module

Insert a new code module from the 'Insert' menu, or open the existing code-behind file for your specific Access form.

3
Add the FollowHyperlink code

Type the following command into your subroutine: Application.FollowHyperlink "https://example.com" (replace the example URL with your actual web address).

4
Run the code

Execute your macro or trigger the form event to launch the default browser and automatically navigate to the specified webpage.

Use the Application.FollowHyperlink Method
Validating URLs: Always ensure that your strURL variable contains a fully qualified URL starting with http:// or https:// to prevent routing errors.
Free Microsoft Office alternative

Looking for a Lightweight Office Suite?

While Microsoft Access is a specialized database management tool, for your everyday document, spreadsheet, and presentation needs, WPS Office offers a powerful, free, and lightweight alternative to Microsoft Office. It provides excellent compatibility with Word, Excel, and PowerPoint formats in an intuitive, tabbed interface.

  1. 1. Download the installer: Visit the official WPS Office website and download the free installation package for your operating system.
  2. 2. Install WPS Office: Run the downloaded installer and follow the on-screen prompts to set up the software.
  3. 3. Open existing files: Launch WPS Office and directly open your existing Word, Excel, or PowerPoint documents without losing any formatting.
Highly compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) file formats.Lightweight design that consumes fewer system resources than heavy office suites.Includes a robust built-in PDF editor and document converter.Free to use with a familiar user interface for a seamless migration.
QA img-9

Frequently Asked Questions

Can I open a specific browser like Google Chrome using Access VBA?

Yes, instead of using FollowHyperlink (which uses the default browser), you can use the VBA Shell function to call a specific browser's executable file followed by the URL. For example: Shell("chrome.exe https://example.com", vbNormalFocus).

Why do I get a runtime error when using FollowHyperlink in VBA?

Errors typically occur if the URL string is missing the protocol prefix (like http:// or https://), if the string contains invalid characters, or if the system cannot locate a default application to handle web links. Ensure your URL is fully qualified.

Is the SendKeys method a reliable way to open a website in VBA?

No, using SendKeys to simulate typing a URL into a browser is generally not recommended. It is unreliable because it relies on the correct application window having active focus at the exact moment the keys are sent. Application.FollowHyperlink is a much safer and cleaner method.