VBA excel to Chrome

zlr1910

New Member
Joined
Nov 2, 2020
Messages
6
Office Version
  1. 2010
Platform
  1. Windows
Im trying to create a VBA which access from excel to login into a certain site.

i try to multiple VBA formula but i am always getting error message which pointed out to the line i have bold below
The current error message i have received are

"Runtime Error 424 'Object Required'"​


What is wrong to the command below?

Sub login()

Const Url$ = "Slync"

Dim UserName As String
Dim Password As String
Dim LoginData As Worksheet

Set LoginData = ThisWorkbook.Worksheets("Sheet1")

UserName = LoginData.Cells(1, 2).Value
Password = LoginData.Cells(2, 2).Value

Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")

With ie

.navigate Url
ieBusy ie
.Visible = True

Dim oLogin As Object
Dim oPassword As Object

Set oLogin = ie.document.getElementById("username")
Set oPassword = ie.document.getElementById("password")


oLogin.Value = UserName
oPassword.Value = Password
.document.forms(0).submit

End With

End Sub


Sub ieBusy(ie As Object)
Do While ie.Busy Or ie.readyState < 4
DoEvents
Loop
End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
.
I am not familiar with the intent of your project as I've never attempted projects that connect to a website. However, by changing
the wait time from <4 to <10 ... I was able to rid the project of the error message received here and the webpage completed
"loading".

I say "loading" because the url Slync was either non-existent or unavailable.
 
Upvote 0
Why not just input the value directly...?
VBA Code:
Sub login()

Const Url$ = "https://kn.slync.app/login"

Dim UserName As String
Dim Password As String
Dim LoginData As Worksheet

Set LoginData = ThisWorkbook.Worksheets("Sheet1")

UserName = LoginData.Cells(1, 2).Value
Password = LoginData.Cells(2, 2).Value

Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")

With ie

.navigate Url$
ieBusy ie
.Visible = True

.document.getElementById("username").value = UserName
.document.getElementById("password").value = Password
.document.forms(0).submit

End With
End Sub

Sub ieBusy(ie As Object)
Do While ie.Busy Or ie.readyState < 4
DoEvents
Loop
End Sub

P.S. Your Const Url$ and Navigation Url does not match.
 
Last edited:
Upvote 0
Why not just input the value directly...?
VBA Code:
Sub login()

Const Url$ = "https://kn.slync.app/login"

Dim UserName As String
Dim Password As String
Dim LoginData As Worksheet

Set LoginData = ThisWorkbook.Worksheets("Sheet1")

UserName = LoginData.Cells(1, 2).Value
Password = LoginData.Cells(2, 2).Value

Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")

With ie

.navigate Url$
ieBusy ie
.Visible = True

.document.getElementById("username").value = UserName
.document.getElementById("password").value = Password
.document.forms(0).submit

End With
End Sub

Sub ieBusy(ie As Object)
Do While ie.Busy Or ie.readyState < 4
DoEvents
Loop
End Sub

P.S. Your Const Url$ and Navigation Url does not match.
i did different format which include the actual Value. It still point out to the Object missing.
I'm not sure if the URL does not match contribute to the error. But i did anyhow change . does not give any different in my opinion.
 
Upvote 0
Strange ... I followed Trixterz suggestion and it worked flawlessly here.

Is there other code you are using in conjunction with the macro ?
 
Upvote 0
Strange ... I followed Trixterz suggestion and it worked flawlessly here.

Is there other code you are using in conjunction with the macro ?
i did try couple of Code as well.
but the end result is similar which is providing me the Object Missing

i somehow made some adjustment to the last line. Where i put the exact ClassName of the "Submit" button.
It work but i have now below error.
It delete all my username and password




1604374837700.png
 
Upvote 0

Forum statistics

Threads
1,224,836
Messages
6,181,251
Members
453,027
Latest member
Lost_in_spreadsheets

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