• Examples Of Using Late Binding To Connect To Internet Explorer

    This article contains an example of using late binding to create a new instance of Internet Explorer.

    Please note that you can copy these code examples into any application that supports VBA, but the called application must be installed on your system for it to work. Just copy them into a standard module and run them. (No references need to be set in the Visual Basic Editor in order to make this code work.)

    Internet Explorer:
    This code will create a new instance of Internet Explorer and bind to it. It will then navigate to the ExcelGuru Excel Pages index. You cannot use the GetObject method used for the rest of the applications to bind to an existing Interent Explorer instance.
    Sub GetInternetExplorer()
    'Author       : Ken Puls (www.excelguru.ca)
    'Create an instance of Microsoft Internet Explorer
    Dim objApp As Object
    'Create instance and set to visible
    On Error GoTo ErrHandler
    Set objApp = CreateObject("InternetExplorer.Application")
    With objApp
        .Visible = True
    End With
    'Add some text to the document
    With objApp
        .Navigate URL:="http://www.excelguru.ca/ExcelPages.htm"
    End With
    'Release the object and resume normal error handling
    Set objApp = Nothing
    On Error GoTo 0
    End Sub


    I'm afraid that you must be logged in to comment or leave a testimonial. I wish it could be otherwise, but I'm trying to keep my site spam free for everyone's benefit. If you don't yet have an account it's completely free to sign up, and a very quick process. Simply click here to Register. Not only can you post a comment here, but it gives you full access to posts questions in our forum as well!


    If you already have an account, and just haven't logged in yet, what are you waiting for? Login Now!