A web browser in a VBA UserForm lets you search the web or open a website without leaving Excel: type a question or an address in a text box, click Search, and the page appears right inside your form. In this tutorial you build PK’s browser form step by step with the Microsoft Web Browser control and one line of VBA. Because this control is built on the old Internet Explorer engine, you will also learn honestly what still works today, what does not, and a modern alternative for files you share with others.

⬇️ Download the Web Browser UserForm
Macro-enabled workbook · .xlsm · Excel for Windows with Internet Explorer components (see the compatibility note)
Watch the Video Tutorial
In the video PK searches for the capital of the US, opens amazon.com and microsoft.com inside the form, then builds it from scratch: a large UserForm, the Microsoft Web Browser control from Additional Controls, a text box, a Search button and one Navigate line.
Important: This Control Uses Internet Explorer
This section is an addition to the original 2018 tutorial. The Microsoft Web Browser control is the Internet Explorer engine packaged as an ActiveX control. In the Additional Controls window its location is ieframe.dll, an Internet Explorer file. That has real consequences today:
- Internet Explorer is retired. Microsoft ended support for the Internet Explorer 11 desktop app on certain versions of Windows on June 15, 2022, and points customers to Microsoft Edge with IE mode. See the Internet Explorer lifecycle FAQ.
- Many modern websites do not support it. In the 2018 video, Bing, YouTube, Amazon and Microsoft.com all opened inside the form. Today, large sites often block Internet Explorer, show an upgrade message, script errors or a blank page. Simple pages and internal intranet pages have the best chance of working.
- It is Windows only. ActiveX controls such as this one are not available in Excel for Mac or Excel for the web.
- It may be blocked. Trust Center or company security policies can disable ActiveX controls, so the control may not load on another person’s computer.
- There is no built-in modern replacement. VBA UserForms have no built-in Edge or WebView2 control. If you need reliable browsing for other users, open the page in the default browser instead (see the alternative below).
So treat this as a fun and useful learning project, and test it on the computers that will actually use your workbook.
What You Will Build
- A large UserForm with a white background.
- A Microsoft Web Browser control filling most of the form.
- A text box where you type a web address or a search question.
- A Search button that sends the text to the browser with one line of VBA.
- A sheet button (in the download) that opens the form while you keep working in Excel.
Part 1: Add the Web Browser Control to Your UserForm
Step 1: Open the VBA editor and insert a UserForm
Go to Developer › Visual Basic or press Alt+F11. Choose Insert › UserForm and drag its corner to make it big, because web pages need room. In the Properties window PK sets the form’s BackColor to white for a clean look.
Step 2: Open the Toolbox
If the Toolbox is not visible, click the form and choose View › Toolbox.

Step 3: Add Microsoft Web Browser from Additional Controls
If the Toolbox does not show the globe-shaped web browser icon, right-click an empty area of the Toolbox and choose Additional Controls.

Scroll down the list, tick Microsoft Web Browser and click OK. Notice the location shown at the bottom of the window: ieframe.dll, the Internet Explorer component this control runs on.

The web browser control now appears as a new icon in the Toolbox.

Step 4: Draw the browser, the text box and the button
- Click the web browser icon and drag a large rectangle on the form. It appears black in design view; that is normal. It is named
WebBrowser1. - Add a TextBox at the top for the address or search text. It is named
TextBox1. - Add a CommandButton next to it and change its Caption to Search. It is named
CommandButton1.

Part 2: The VBA Code for the Search Button
Step 5: Add one line of code
Double-click the Search button to open its click event and type:
Private Sub CommandButton1_Click()
Me.WebBrowser1.Navigate Me.TextBox1.Value
End Sub
How the code works
Meis the UserForm itself, soMe.WebBrowser1is the browser control on it.Navigatetells the browser to load an address. Its first argument is the URL as text; the other arguments (flags, target frame, post data, headers) are optional and not needed here.Me.TextBox1.Valuepasses whatever you typed in the text box as that address.
Step 6: Run it
Press F5. Type a website such as microsoft.com and click Search to open it, or type a question such as what is the capital of India. In the video, text that was not a web address was sent to Internet Explorer’s default search provider, Bing, and the answer appeared in the form. Your computer must be connected to the internet.
Part 3: Open the Form from the Worksheet
In the downloadable workbook the finished form is called myform, and a button on Sheet1 opens it with this code:
Private Sub CommandButton1_Click()
myform.Show False
End SubShow False opens the form modeless, so you can keep clicking and typing in the worksheet while the browser form stays open. With a plain myform.Show the form would block Excel until you close it.
An Improved Version of the Search Button (Addition)
This code is an addition to PK’s original one-liner. It ignores an empty box, turns plain words into a proper Bing search address instead of relying on Internet Explorer’s old search setting, and sets Silent to hide script error pop-ups from pages that use modern JavaScript.
Private Sub CommandButton1_Click()
Dim target As String
target = Trim(Me.TextBox1.Value)
If target = "" Then Exit Sub
'plain words or a question: build a Bing search address
If InStr(target, " ") > 0 Or InStr(target, ".") = 0 Then
target = "https://www.bing.com/search?q=" & _
Application.WorksheetFunction.EncodeURL(target)
End If
Me.WebBrowser1.Silent = True 'hide script error pop-ups
Me.WebBrowser1.Navigate target
End SubEncodeURL converts spaces and special characters so the search text is safe inside an address. It needs Excel 2013 or later on Windows.
Modern Alternative: Open the Page in the Default Browser (Addition)
If the embedded control cannot show the site you need, keep the same text box and button, but open the page in the user’s default browser (usually Edge or Chrome) with FollowHyperlink. You lose the in-form view, but every modern website works and nothing depends on Internet Explorer.
Private Sub CommandButton1_Click()
Dim target As String
target = Trim(Me.TextBox1.Value)
If target = "" Then Exit Sub
If InStr(target, " ") > 0 Or InStr(target, ".") = 0 Then
target = "https://www.bing.com/search?q=" & _
Application.WorksheetFunction.EncodeURL(target)
ElseIf LCase(Left(target, 4)) <> "http" Then
target = "https://" & target
End If
ThisWorkbook.FollowHyperlink target 'opens in the default browser
End SubReference: Workbook.FollowHyperlink method (Microsoft Learn).
Common Errors and Fixes
- Microsoft Web Browser is not in the Additional Controls list. The Internet Explorer components it needs are missing or disabled on this Windows installation. Use the FollowHyperlink alternative.
- The page is blank or shows an upgrade-your-browser message. The site no longer supports Internet Explorer. Try a simpler page or open it in the default browser.
- Script error pop-ups keep appearing. Set
Me.WebBrowser1.Silent = Truebefore callingNavigate. - The form will not open on a colleague’s PC. ActiveX controls may be blocked by their Trust Center or company policy, or they are on a Mac. Share the FollowHyperlink version instead.
Tips
- Make the form large and size the browser control to fill most of it; web pages are hard to read in a small window.
- Set the Search button’s Default property to True so pressing Enter in the text box runs the search. (Addition.)
- Use the control for simple or internal pages, such as a help page or an intranet report, rather than large public websites.
- To pull data from the web into cells, Power Query (Data › From Web) is more reliable than a browser control. (Addition.)
- Microsoft’s documentation for the control’s properties and methods: WebBrowser object (Microsoft Learn, archived).
Want It Ready-Made?
If you want finished Excel automation tools rather than building them, browse the Excel VBA tools collection on NextGenTemplates.com, with ready-made UserForm applications, converters and data entry systems.
Related Tutorials
- 5 VBA UserForm Super Tips
- VBA Multilevel Dependent Drop-Down in a UserForm
- VBA: Dynamic Chart on a UserForm
- Time Picker and Date Time Picker Control in VBA
- 33 Useful VBA Shortcut Keys
Frequently Asked Questions
How do I add a web browser to a VBA UserForm?
Open the VBA editor, right-click the Toolbox, choose Additional Controls and tick Microsoft Web Browser. Draw the new control on the form, add a TextBox and a CommandButton, and in the button click event call the Navigate method of WebBrowser1 with the TextBox value.
Does the Microsoft Web Browser control still work?
It depends on your Windows and Office setup. The control uses the old Internet Explorer engine, so it may still load simple pages, but many modern websites no longer support Internet Explorer and may show errors or blank pages. Test it on the computers that will use your file.
Why can I not find Microsoft Web Browser in Additional Controls?
The control comes from Internet Explorer components in Windows. If they are missing, or ActiveX controls are blocked by your Trust Center or company policy, it will not appear or will not load. It is also not available in Excel for Mac.
Can I use Microsoft Edge inside a VBA UserForm?
VBA UserForms have no built-in Edge or WebView2 control. The simplest modern option is to open the link in the default browser with ThisWorkbook.FollowHyperlink, as shown in the alternative section.
Why does typing a question instead of a web address still work?
In the video, Internet Explorer passed any text that was not a web address to its default search provider, Bing, so a question like what is the capital of India returned search results. Building the search address yourself, as in the improved code, makes this behaviour predictable.
Is the workbook free to download?
Yes. The free macro-enabled workbook contains the finished browser form and a button on the sheet that opens it. Use the green download button near the top of this page.
About the Author
PK is a Microsoft Excel expert and trainer and the founder of PK: An Excel Expert and NextGenTemplates.com. He has been teaching Excel, VBA, Power Query and Power BI since 2016 on his YouTube channel.
Conclusion
A web browser in a VBA UserForm takes only the Microsoft Web Browser control, a text box, a button and one Navigate line. It is a great way to learn Additional Controls and form events, and it still suits simple or internal pages. Because the control runs on the retired Internet Explorer engine, test it before you share it, and switch to FollowHyperlink when you need every modern website to open reliably.



