Dim objIE
Dim el
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
'IEを開く
objIE.navigate "https://dauth.user.ameba.jp/authenticate?client_id=db98bf8b687fc3334c4b8cde9116687fd75eb285ed5a2373df8010ae070f5338&redirect_uri=https%3A%2F%2Fdauth.user.ameba.jp%2Fauthorize%3Fscope%3Dprofile%252Capplication%252Cconnection%252Cphoto%252Ccoin%26response_type%3Dcode%26client_id%3Ddb98bf8b687fc3334c4b8cde9116687fd75eb285ed5a2373df8010ae070f5338%26redirect_uri%3Dhttps%253A%252F%252Fwww.ameba.jp%252Foauth%252Fameba%252Fcallback%26provider_id%3Dameba&provider_id=ameba"
'ページが読み込まれるまで待つ
Do While objIE.Busy = True Or objIE.readyState <> 4
WScript.Sleep 100
Loop
'a要素にログインがあったらクリックする
For each el In objIE.document.Links
if instr(el.innerText,"ログイン") then
el.click
exit for
end if
next
'ページが読み込まれるまで待つ
Do While objIE.Busy = True Or objIE.readyState <> 4
WScript.Sleep 100
Loop
'IDとパスワードを入力する
With objIE.document
.getElementsByName("accountId")(0).Value = ""
.getElementsByName("password")(0).Value = "2"
End With
Dim objbutton
'button要素をコレクションとして取得
Set objbutton = objIE.document.getElementsByTagName("button")
'button要素にログインがあったらクリックする
For each el In objbutton
if instr(el.innerText,"ログイン") then
el.click
exit for
end if
next
