質問編集履歴

1

試したことを追記しました。

2019/02/25 09:21

投稿

unotalk
unotalk

スコア124

test CHANGED
File without changes
test CHANGED
@@ -103,3 +103,71 @@
103
103
  End Sub
104
104
 
105
105
  ```
106
+
107
+
108
+
109
+ 試したこと
110
+
111
+ 1.WaitTimeを10から1000に変更→結果、変化なし
112
+
113
+ ```VBA
114
+
115
+ Sub untilReady(objIE As Object, Optional ByVal WaitTime As Integer = 1000)
116
+
117
+ ```
118
+
119
+
120
+
121
+ 2.UntilReadyを削除し、Sleepを使用→結果、変化なし
122
+
123
+ ```VBA
124
+
125
+ Private Declare Sub Sleep Lib "kernel32" (ByVal ms As Long)
126
+
127
+
128
+
129
+ Sub maker()
130
+
131
+ Dim i As Long
132
+
133
+ Dim j As Long
134
+
135
+
136
+
137
+ Dim objITEM As Object
138
+
139
+ Dim objIE As New InternetExplorer
140
+
141
+ objIE.Visible = True
142
+
143
+
144
+
145
+ For j = 1 To 5
146
+
147
+ objIE.navigate "http://example.com?id=" & j
148
+
149
+ Sleep 1000
150
+
151
+ Range("A1").CurrentRegion.Offset(1, 0).ClearContents
152
+
153
+ i = 2
154
+
155
+ For Each objITEM In objIE.document.querySelectorAll("th, td")
156
+
157
+ Cells(i, j) = objITEM.innerText
158
+
159
+ i = i + 1
160
+
161
+ Next
162
+
163
+ Next
164
+
165
+ objIE.Quit
166
+
167
+ Set objITEM = Nothing
168
+
169
+ Set objIE = Nothing
170
+
171
+ End Sub
172
+
173
+ ```