Customer Center

Welcome back

My Account Logout
#4955
Anonymous
Inactive

This is what I have used to connect to IE 11 and works well on both my Windows 7 and Windows Server 2012 R2 Boston emulations. Also avoids issues I have where the home page isn't standard by going directly to the web page I need. The maximize I use to standardize the location of the file save as when downloading from the web.

Note the script logging is something I have to track progress and for troubleshooting. Left it in in case interested but not really a part IE11. I use that throughout my script for troubleshooting issues.

'Declarations
    'Website Variables
        Const IEPath = """C:Program Files (x86)Internet Exploreriexplore.exe"""
        Const WebsiteURL = "https://milogintp.michigan.gov/eai/tplogin/authenticate?URL=/" 'Replace with Webpage address needed

    'IE Maximize Variable
        Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
            (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

        Global Const SW_MAXIMIZE = 3
        Global Const SW_SHOWNORMAL = 1
        Global Const SW_SHOWMINIMIZED = 2

    'Script Log File Variables
        Const LogFileLocation = "C:#BWSScriptsCHAMPS_NewbornScriptLog"
        Const LogFileExt = ".txt"
        Public LogFileName As String
        Public LogFileDate As String

    '===Open Website===
   
        'Write Log Entry to Log File
            ScriptSegment = "Open Website"
            WritetoLog "ScriptSegment: " & ScriptSegment, LogFileName
           
        'Open Internet Explorer In Maximized View
            Dim objIE As Object
            Set objIE = CreateObject("InternetExplorer.Application")
            objIE.Visible = True
            apiShowWindow objIE.hwnd, SW_MAXIMIZE
            objIE.Navigate WebsiteURL
            TimeOut = 300
            Wait 5

         'Activate Default Webpage
            Activate "SOM*", True 'Replace SOM* with webpage title
       
        'Connect to SOM Login Website
            Connect "SOM*", stWeb1 'Replace SOM* with webpage title
            TimeOut = GlobalTimeout
            Wait 2