none
VBA to open Internet Explorer 8 RRS feed

  • Question

  • Hi,

    I have 2 version of Internet explorer 10 and 8

    I want to open Internet Explorer 8 through VBA code(MS Access)

    Thanks


    hi


    Tuesday, June 16, 2015 9:33 PM

All replies

  • I think it will be something like this.  I don't have IE8 so you'll have to test it.

    Sub openIE()
    
      Dim WScript
    Dim objShellWindows
    
     Set objShell = CreateObject("Shell.Application")
     Set objShellWindows = objShell.Windows
     Set WScript = CreateObject("WScript.Shell")
    
    
     Dim ieStarted
     ieStarted = False
    
      Dim ieError
      ieError = False
    
        Dim seconds
          seconds = 0
    
      While (Not ieStarted) And (Not ieError) And (seconds < 30)
    
    If (Not objShellWindows Is Nothing) Then
        Dim objIE As InternetExplorer
        Dim IE
    
    
        For Each objIE In objShellWindows
    
            If (Not objIE Is Nothing) Then
    
                If IsObject(objIE.Document) Then
                    Set IE = objIE.Document
    
                    If VarType(IE) = 8 Then
    
                        If IE.Title = EmptyTitle Then
                            If Err.Number = 0 Then
                                IE.Write LoadingMessage
    
                            
                            ieStarted = True
                            Set GetIE = objIE
    
    
                          Else
    
                           MsgBox ErrorMessage
                                Err.Clear
                                ieError = True
    
                                Exit For
                            End If
                        End If
                    End If
                End If
            End If
    
            Set IE = Nothing
            Set objIE = Nothing
        Next
    End If
    
    Application.Wait Now + TimeValue("00:00:1")
    seconds = seconds + 1
    Wend
    
     Set objShellWindows = Nothing
     Set objShell = Nothing
     
    End Sub
    


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Tuesday, June 16, 2015 10:27 PM