teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

質問内容の修正に伴いコード修正

2016/10/25 14:21

投稿

hatena19
hatena19

スコア34367

answer CHANGED
@@ -2,21 +2,20 @@
2
2
 
3
3
  ```VBA
4
4
  Sub sample()
5
-
6
5
  Dim objIE As Object
7
6
  Dim objLink As Object
8
7
 
9
8
  Set objIE = CreateObject("InternetExplorer.Application")
10
9
  objIE.Visible = True 'ieを表示
11
- objIE.navigate "http://目的のページ.html"
10
+ objIE.navigate "http://目的のページ.html"
12
- Do While objIE.Busy Or (objIE.ReadyState <> 4): Loop '表示待ち
11
+ Do While objIE.Busy = True Or objIE.ReadyState <> 4: DoEvents: Loop '表示待ち
13
12
 
14
- For Each objLink In objIE.document.Links
13
+ For Each objLink In objIE.Document.Links
15
- If objLink.getAttribute("data-rapid_p") Like "[246]" Then
14
+ Select Case objLink.getAttribute("data-rapid_p")
15
+ Case "23", "24", "25", "26"
16
- objLink.Click
16
+ objLink.Click
17
- End If
17
+ End Select
18
18
  Next
19
19
 
20
-
21
20
  End Sub
22
21
  ```