みんなの「教えて(疑問・質問)」にみんなで「答える」Q&Aコミュニティ

こんにちはゲストさん。会員登録(無料)して質問・回答してみよう!

締切り済みの質問

Aa

Microsoft Internet Controlsの参照設定
Option Explicit

Sub テキストボックス操作()
Dim ie As InternetExplorer
Dim txtInput As HTMLInputElement
Dim txtOutput As HTMLInputElement

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "http://book.impress.co.jp/appended/3384/4-2.html"
Do While ie.Busy Or ie.readyState < READYSTATE_COMPLETE
DoEvents
Loop

Set txtInput = ie.document.getElementById("Text1")
MsgBox txtInput.Value

Set txtOutput = ie.document.getElementById("Text2")
txtOutput.Value = "VBA からの書き込み"
End Sub

Sub ラジオボタンの操作()
Dim ie As InternetExplorer
Dim radio1 As HTMLInputElement
Dim radio2 As HTMLInputElement

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "http://book.impress.co.jp/appended/3384/4-6.html"
Do While ie.Busy Or ie.readyState < READYSTATE_COMPLETE
DoEvents
Loop

For Each radio1 In ie.document.getElementsByName("Radio1")
If radio1.Checked = True Then
MsgBox radio1.Value
Exit For
End If
Next

For Each radio2 In ie.document.getElementsByName("Radio2")
If radio2.Value = "女" Then
radio2.Checked = True
Exit For
End If
Next
End Sub

Sub ハイパーリンクをクリック()
Dim ie As InternetExplorer
Dim anchor As HTMLAnchorElement

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "http://book.impress.co.jp/appended/3384/4-7.html"
Do While ie.Busy Or ie.readyState < READYSTATE_COMPLETE
DoEvents
Loop

For Each anchor In ie.document.getElementsByTagName("A")
If anchor.innerText = "やきそばパン vs 揚げパン" Then
anchor.Click
Exit For
End If
Next
End Sub

Sub ボタンをクリックボタン2()
Dim ie As InternetExplorer
Dim button As HTMLInputElement

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "http://book.impress.co.jp/appended/3384/4-8.html"
Do While ie.Busy Or ie.readyState < READYSTATE_COMPLETE
DoEvents
Loop

For Each button In ie.document.getElementsByTagName("INPUT")
If button.Type = "button" And button.Value = "ボタン2" Then
button.Click
Exit For
End If
Next
End Sub

投稿日時 - 2019-03-18 11:44:58

QNo.9598102

暇なときに回答ください

このQ&Aは役に立ちましたか?

0人が「このQ&Aが役に立った」と投票しています

回答(1)

ANo.1

 
質問は何ですか?
 

投稿日時 - 2019-03-18 11:51:37

あなたにオススメの質問