เกิด eror 438 ในการ iogin vba web google แก้ยังไงครับ
Posted: Sun Aug 30, 2020 12:08 am
Code: Select all
Sub GMAIL_Login()
'Set a reference (VBE > Tools > References) to the following libraries:
' 1) Microsoft Internet Controls
' 2) Microsoft HTML Object Library
Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As New MSHTML.HTMLDocument
Dim HTMLElement As MSHTML.IHTMLElement
With IE
.Visible = True
.Silent = True
.navigate "https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin"
Do While .Busy Or .readyState <> READYSTATE_COMPLETE
DoEvents
Loop
End With
Call WaitAFewSeconds
Set HTMLDoc = IE.document
HTMLDoc.all.Email.Value = "nutpochan1@gmail.com"
HTMLDoc.all.SignIn.Click
With IE
Do While .Busy Or .readyState <> READYSTATE_COMPLETE
DoEvents
Loop
End With
Call WaitAFewSeconds
For Each HTMLElement In HTMLDoc.getElementsByName("Passwd")
If HTMLElement.getAttribute("type") = "password" Then
HTMLElement.Value = "mypassword"
Exit For
End If
Next HTMLElement
HTMLDoc.all.SignIn.Click
Set IE = Nothing
Set HTMLDoc = Nothing
Set HTMLElement = Nothing
End Sub
Private Sub WaitAFewSeconds()
Dim sngStart As Single
Const PAUSE_TIME As Integer = 5 'seconds
sngStart = Timer
Do Until Timer - sngStart > PAUSE_TIME
DoEvents
Loop
End Sub
ในคำสั่ง
Code: Select all
HTMLDoc.all.Email.Value = "nutpochan1@gmail.com"
eror 438
oject doesn't support this property of method
จะสามารถแก้ยังไงให้รัน codeผ่านครับ