回答編集履歴

1

コード修正

2019/12/13 01:22

投稿

hatena19
hatena19

スコア34073

test CHANGED
@@ -52,16 +52,42 @@
52
52
 
53
53
  ```vba
54
54
 
55
- Dim ExampleID as long
55
+ Dim ExampleID as String
56
56
 
57
- Dim objtag AS Object
57
+ Dim objClass AS Object
58
58
 
59
- For Each objtag In objIE.document.getElementsByClassName("ABC")
59
+ For Each objClass In objIE.document.getElementsByClassName("ABC")
60
60
 
61
+ ExampleID = objClass.innerTExt
61
62
 
62
-
63
- debug.print objtag.innerTExt
63
+ debug.print ExampleID
64
64
 
65
65
  Next
66
66
 
67
67
  ```
68
+
69
+ もし、class="ABC" がテーブル以外の要素にもついていて、テーブル内の要素(td)のみに限定したいなら、
70
+
71
+
72
+
73
+ ```vba
74
+
75
+ Dim ExampleID as String
76
+
77
+ Dim objtag AS Object
78
+
79
+ Dim objClass As Object
80
+
81
+ For Each objtag In objIE.document.getElementsByTagName("tr")
82
+
83
+ For Each objClass In objTag
84
+
85
+ ExampleID = objClass.innerTExt
86
+
87
+ debug.print ExampleID
88
+
89
+ Next
90
+
91
+ Next
92
+
93
+ ```