VBA - auto login to website

ashk0812

New Member
Joined
Sep 27, 2019
Messages
11
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Greetings,

I wonder if anyone can help me, I am not really that experienced with macros and vba most of what I been able to acomplish thus far is via youtube tutorials.

I am trying to create a macro to open a IE window and load up a webpage and then log in to it however I keep getting an automation error with unspecified error underneath

This is the code I have for the macro


Code:
Sub FUNC_LOGIN_KRONOS()

Dim appIE As InternetExplorerMedium
Set appIE = Nothing
Dim objElement As Object
Dim objCollection As Object

Set appIE = New InternetExplorerMedium
sURL = "https://kronos-emea.dhl.com/wfc/logon/"
With appIE
    .navigate sURL
    .Visible = True
End With

Do While appIE.Busy Or appIE.ReadyState <> 4
   DoEvents
Loop
appIE.Document.getElementById("username").Value = _
      Sheets("Setup").Range("I12").Value
appIE.Document.getElementById("password").Value = _
      Sheets("Setup").Range("I14").Value




End Sub

Any help anyone can offer would be greatly appreciated
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Code:
Sub FUNC_LOGIN_KRONOS()
Dim appIE As Object: Set appIE = CreateObject("InternetExplorer.Application")
With appIE
    .navigate "https://kronos-emea.dhl.com/wfc/logon/"
    Do While .Busy Or .readyState < 4: DoEvents: Loop
    .Visible = True
    .document.all.UserName.Value = Sheets("Setup").Range("I12").Value
    .document.all.Password.Value = Sheets("Setup").Range("I14").Value
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,667
Messages
6,120,822
Members
448,990
Latest member
rohitsomani

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top