WebBrowser control only displays a blank screen

  • I have searched and found a lot of references to the web browser control for a user form. I have tried and tried but all I get is a blank webbrowser control.

    I have tried the navigate and navigate2 methods and other stuff that you can see that I have commented out. Also, I tried placing the line with the navigate method both before and after the userform.show method. But all I get is a blank web browser on the form.

    Here is what (sort of) I have tried:

    So, what's the trick. All the stuff I found searching the web implies that what I have above should work.

    Regards Jim

  • Re: WebBrowser control only displays a blank screen

    Try this - assuming you want the WebBrowser to open a local .html file as shown by your code. Note the 3 forward slashes following "file:" and %20 to encode a space. Open the .html file in your browser and use the URL shown in the address bar if you're not sure what the Navigate string should be.


    Sub Show_Form()
        Dim frm As UserForm1
        Set frm = New UserForm1
    End Sub


    Private Sub UserForm_Initialize()
        WebBrowser1.Navigate "file:///C:/Test%20files/temp.html"
    End Sub
  • Re: WebBrowser control only displays a blank screen


    I tried again and still all I get is a blank browser control on the form. I moved the html file to my local c:\ drive instead of the mapped drive to our network server file space and there are no spaces to be concerned with, tried both forward and back slashes. I tried one of the infamous search sites, too. I tried (again) placing the .show command before and after the .navigate command.

    Here is my code again with all of the paths I tried (all but one commented):

    Sub ShowTheForm()
        'WebBrowser1.Navigate "[URL]file:///j:/temp/WebBrowser1_image.jpg[/URL]"
        'WebBrowser1.Navigate "J:\temp\WebBrowser1.html"
        'WebBrowser1.Navigate "[URL]file:///c:/temp/WebBrowser1.html[/URL]"
        'WebBrowser1.Navigate "[URL]file:///c:\temp\WebBrowser1.html[/URL]"
        'WebBrowser1.Navigate "c:\temp\WebBrowser1.html"
        WebBrowser1.Navigate "[URL]http://www.google.com[/URL]"
    End Sub

    I'm wondering if there is some setting that I need to change or if our company's IT department has done something to prevent this from working; we can't even use the MSI installer utility.

  • Re: WebBrowser control only displays a blank screen

    Hi again; and sorry for being so stupid. The control works and the navigate method works, if you put the code in a regular module and not in with the userform code module.
    (DUH!) LOL

  • Re: WebBrowser control only displays a blank screen

    My code works with the .Navigate in the userform module. Look carefully at the module names in my post which indicate where each piece of code should reside and it should work for you too.

  • Re: WebBrowser control only displays a blank screen

    Here's an example workbook with a web browser in.

  • I appreciate that this is a very old post, but this is exactly the problem I am wrangling with. The excellent example works with a web address, but I want to do the same with a local html file which contains an interactive map. The example spreadsheet reads the html file and opens the web browser but with no content. The html file will open in internet explorer outside of excel. Any help would be appreciated. I am working with excel 2010.
    Many thanks

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!