現状、入力フォームをHTMLから探して、指定の数字を入力しているのですが、同じブラウザ画面上の数字
入力フォームのすぐとなりの数字を取得して自動で入力してくれるというマクロを組みたいです。
アドバイス頂ければと思います。
Sub yahoo_auction_sample1()
'---コード1|インターネットに接続してブラウザを開く---
Dim objIE As InternetExplorer
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
'---コメオクページ開く--- objIE.navigate "https://www.komehyo-auction.com/auctionManagement/xhtml/wc/WC11001L.xhtml" Call IEWait(objIE) 'IEを待機 Call WaitFor(2) '3秒停止 '---ログイン--- Dim objtsugi As Object For Each objtsugi In objIE.document.getElementsByTagName("span") If InStr(objtsugi.outerHTML, "ログイン") > 0 Then objtsugi.Click Call WaitFor(3) Exit For End If Next '---オークション参加---
Dim objsanka As Object
For Each objsanka In objIE.document.getElementsByTagName("label")
If InStr(objsanka.outerHTML, "オークション商品") > 0 Then
objsanka.Click
Call WaitFor(3)
Exit For
End If
Next
'---選択--- Dim objsentaku As Object For Each objsentaku In objIE.document.getElementsByTagName("button") If InStr(objsentaku.outerHTML, "選択") > 0 Then objsentaku.Click Call WaitFor(4) Exit For End If Next '---商品検索--- Dim objkensaku As Object For Each objkensaku In objIE.document.getElementsByTagName("button") If InStr(objkensaku.outerHTML, "商品検索へ") > 0 Then objkensaku.Click Call WaitFor(6) Exit For End If Next '---開始額並べ替え--- Dim objkaisi As Object For Each objkaisi In objIE.document.getElementsByTagName("th") If InStr(objkaisi.outerHTML, "開始額") > 0 Then objkaisi.Click Call WaitFor(3) Exit For End If Next '---20箇所一括入力--- Dim s As String
s = "2000"
Dim objtag, objsubmit As Object
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-0-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-1-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-2-net_bid_price""") > 0 Then
objtag.Value = s
End Ifa
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-3-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-4-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-5-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-6-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-7-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-8-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-9-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-10-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-11-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-12-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-13-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-14-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-15-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-16-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-17-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-18-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
For Each objtag In objIE.document.getElementsByTagName("input")
If InStr(objtag.outerHTML, """f-a-DetailData1-19-net_bid_price""") > 0 Then
objtag.Value = s
End If
Next
'---ページ2へ--- Dim objpage2 As Object For Each objpage2 In objIE.document.getElementsByTagName("a") If InStr(objpage2.outerHTML, "Page 2") > 0 Then objpage2.Click Call WaitFor(3) Exit For End If Next
End Sub
あなたの回答
tips
プレビュー