用
Sub bb()
Dim myIE As Object
Set myIE = New InternetExplorer
With myIE
.Visible = True
.Navigate "https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/&hl=zh-TW#identifier"
Do Until .ReadyState = 4
Loop
With .Document.all
.Item("Email").Value = "你的google帳號"
.Item("next").Click
Application.Wait Now + TimeValue("00:00:03")
.Item("Passwd").Value = "你的google密碼"
.Item("next").Click
End With
End With
End Sub
-----------------------------------------------------------------------------------------------------------
解釋
Sub bb()
Dim myIE As Object
'宣告myIE為一個物件
Set myIE = New InternetExplorer
'開新視窗(以IE操作)
With myIE
.Visible = True
'Visible屬性用來設定是否將網頁顯示
.Navigate "https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/&hl=zh-TW#identifier"
'Navigate屬性用來指定網址
Do Until .ReadyState = 4
Loop
'跑迴圈直到開啟完成
With .Document.all '用all.item模式設定
.Item("Email").Value = "你的帳號google"
.Item("next").Click '點擊下一步的按鈕
Application.Wait Now + TimeValue("00:00:03")
'等待三秒鐘讓網頁運作
.Item("Passwd").Value = "你的google密碼"
.Item("next").Click
End With
End With
End Sub
-------------------------------------------------------------------------------------------------------------
20160310 .VBA