Results 1 to 3 of 3

Thread: Unable to connect IE
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular Pranesh's Avatar
    Join Date
    Jun 2014
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Unable to connect IE

    Hi All,


    Im trying to connect a webpage using a code which i got from a website. When I tried with the default URL available in the code it worked perfectly.


    I changed the URL to the URL which i need to open and i get the following error "Automation error The object invoked has disconnected from its client"


    Can someone help me to fix this please.

    Code:
    Sub Automate_IE_Load_Page()
    'This will load a webpage in IE
        Dim i As Long
        Dim URL As String
        Dim IE As Object
        Dim objElement As Object
        Dim objCollection As Object
     
        'Create InternetExplorer Object
        Set IE = CreateObject("InternetExplorer.Application")
     
        'Set IE.Visible = True to make IE visible, or False for IE to run in the background
        IE.Visible = True
       
     
        'Define URL
        'URL = "https://www.automateexcel.com/excel/"
        
        'Navigate to URL
        IE.Navigate URL
        
     
        ' Statusbar let's user know website is loading
        Application.StatusBar = URL & " is loading. Please wait..."
     
        ' Wait while IE loading...
        'IE ReadyState = 4 signifies the webpage has loaded (the first loop is set to avoid inadvertently skipping over the second loop)
        
        Do While IE.READYSTATE = 4: DoEvents: Loop   'Do While
        Do Until IE.READYSTATE = 4: DoEvents: Loop   'Do Until
     
        'Webpage Loaded
        Application.StatusBar = URL & " Loaded"
     
        'Unload IE
        Set IE = Nothing
        Set objElement = Nothing
        Set objCollection = Nothing
        
    End Sub

  2. #2
    Board Regular
    Join Date
    Mar 2019
    Location
    India
    Posts
    162
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Unable to connect IE

    Hi your URL is commented so you might be getting that error

    URL = "https://www.automateexcel.com/excel/"

    Without the above line is active , it cannot navigate to any page using IE
    Last edited by GirishDhruva; Jun 24th, 2019 at 07:13 AM.

  3. #3
    Board Regular Pranesh's Avatar
    Join Date
    Jun 2014
    Posts
    206
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Unable to connect IE

    Quote Originally Posted by GirishDhruva View Post
    Hi your URL is commented so you might be getting that error

    URL = "https://www.automateexcel.com/excel/"

    Without the above line is active , it cannot navigate to any page using IE
    Hi Girish,

    Thanks for your response.

    I have made the comment active. But i still get the debug at this line - Do While IE.READYSTATE = 4: DoEvents: Loop

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •