How Excel VBA Controlling IE local intrenet?

How Excel VBA Controlling IE local internet?

Asked on October 27, 2018 in VBA.
Add Comment


  • 3 Answer(s)

    It is the quick and easy solution for this issue:
    Instead of:

    set IE = createobject("internetexplorer.application")
    
    

    Use:

    Set IE = New InternetExplorerMedium
    
    Answered on October 27, 2018.
    Add Comment

    We might also need to use the InternetExplorerMedium object as opposed to the InternetExplorer object.

    • References for MS Office VBA:
    • Microsoft Internet Controls
    • Microsoft Shell Controls and Automation
    Dim IE As InternetExplorerMedium ' This object (the "medium" variety as opposed to "InternetExplorer") is necessary in our security climate
    Dim targetURL As String
    Dim webContent As String
    Dim sh
    Dim eachIE
     
    targetURL = "[your URL here]"
    Set IE = New InternetExplorerMedium
    IE.Visible = False ' Set to true to watch what's happening
    IE.Navigate targetURL
     
    While IE.Busy
        DoEvents
        Wend
    Do
        Set sh = New Shell32.Shell
        For Each eachIE In sh.Windows
            If InStr(1, eachIE.LocationURL, targetURL) Then
                Set IE = eachIE
                'IE.Visible = False 'This is here because in some environments, the new process defaults to Visible.
     
                Exit Do
                End If
            Next eachIE
        Loop
    Set eachIE = Nothing
    Set sh = Nothing
     
    While IE.Busy ' The new process may still be busy even after you find it
        DoEvents
        Wend
    
    Answered on October 27, 2018.
    Add Comment

    Use this code:

    Set IE = GetObject("new:{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}")
    
    

    This code will help us to solve the Excel VBA Controlling IE local intranet

    Answered on October 27, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.