質問編集履歴

2

解決いたしました

2017/03/08 08:07

投稿

hatsuk0i1216
hatsuk0i1216

スコア14

test CHANGED
File without changes
test CHANGED
@@ -19,257 +19,3 @@
19
19
 
20
20
 
21
21
  出力された情報をエクセルへ貼り付け
22
-
23
-
24
-
25
-
26
-
27
- ###発生している問題・エラーメッセージ
28
-
29
- 在庫確認ページへアクセスすると、framesetが2つ表示となっており、
30
-
31
- 実際の商品コードで問い合わせたいページはstock.aspとなっている。
32
-
33
-
34
-
35
- stock.aspへ直接アクセスしようとすると、index.htmlへ強制的に飛ばされる。
36
-
37
-
38
-
39
- 「アプリケーション定義またはオブジジェクト定義のエラーです。
40
-
41
- データ型を数値もしくは文字列形に変更すると、
42
-
43
- 「コンパイルエラー オブジェクトが必要です。」
44
-
45
- となります。
46
-
47
- 実際に代入される値は文字列なのですが・・・。
48
-
49
- ここではどれを入れればよろしいのでしょうか・・・。
50
-
51
- (integer long object string variantはすべて試しました。)
52
-
53
-
54
-
55
- ###該当のソースコード
56
-
57
- <該当HTML>
58
-
59
- □在庫確認ページ
60
-
61
- <html>
62
-
63
- <head>
64
-
65
- <title>- ********************* -</title>
66
-
67
- <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
68
-
69
- </head>
70
-
71
-
72
-
73
- <frameset rows="80,*" frameborder="NO" border="0" framespacing="0">
74
-
75
- <frame name="topFrame" scrolling="NO" noresize src="stock_head.html" marginwidth="0" marginheight="0">
76
-
77
- <frame name="mainFrame" src="stock.asp" marginwidth="0" marginheight="0"></frameset>
78
-
79
-
80
-
81
- <noframes>
82
-
83
- <body bgcolor="#FFFFFF" text="#000000">
84
-
85
- </body>
86
-
87
- </noframes>
88
-
89
-
90
-
91
- </html>
92
-
93
- □stock.aspのページ
94
-
95
- <body style="background:white url(*********************.gif) no-repeat top left;" text="#000000">
96
-
97
- <table width="744" border="0" cellspacing="0" cellpadding="0" align="center">
98
-
99
- <tr><td>
100
-
101
- <table width="605" border="0" align="center">
102
-
103
- <tr><td height="80"> </td></tr>
104
-
105
-
106
-
107
- '=================================下記からが触りたい部分です。============================
108
-
109
- <tr>
110
-
111
- <td align="right">
112
-
113
- <table style="width:600px;" border="1" cellspacing="0" cellpadding="2" bordercolor="#000000" bordercolorlight="#FFFFFF" bgcolor="#FFFFFF">
114
-
115
- <form method="post" action="stock.asp">
116
-
117
- <tr>
118
-
119
- <td bgcolor="#FF9999" style="width:100px;" class="j14">商品コード</td>
120
-
121
- <td colspan="2" style="width:200px;">
122
-
123
- <input type="text" name="txtSyohincd" size="15" value="" maxlength="12" style="width:100px;">
124
-
125
- <input type="submit" value="問合せ" name="cmdQuery" class="j12">
126
-
127
- </td>
128
-
129
- <td bgcolor="#FF9999" style="width:100px;" class="j14">メーカー品番</td>
130
-
131
- <td colspan="2" style="width:200px"><br></td>
132
-
133
- </tr>
134
-
135
- <tr>
136
-
137
- <td bgcolor="#FF9999" class="j14">商品名称</td>
138
-
139
- <td colspan="5"><br></td>
140
-
141
- </tr>
142
-
143
- <tr>
144
-
145
- <td bgcolor="#FF9999" style="width:100px;" class="j14">単位</td>
146
-
147
- <td style="width:100px;"><br></td>
148
-
149
- <td bgcolor="#FF9999" style="width:100px;" class="j14">在庫数</td>
150
-
151
- <td style="width:100px;"><br></td>
152
-
153
- <td bgcolor="#FF9999" style="width:100px;" class="j14">標準納期(日)</td>
154
-
155
- <td style="width:100px;"><br></td>
156
-
157
- </tr>
158
-
159
- <tr>
160
-
161
- <td bgcolor="#FF9999" class="j14">定価</td>
162
-
163
- <td><br></td>
164
-
165
- <td bgcolor="#FF9999" class="j14">仕切率(%)</td>
166
-
167
- <td><br></td>
168
-
169
- <td bgcolor="#FF9999" class="j14">送料</td>
170
-
171
- <td><br></td>
172
-
173
- </tr>
174
-
175
- <tr>
176
-
177
- <td bgcolor="#FF9999" class="j14">仕切値</td>
178
-
179
- <td colspan="5"><br></td>
180
-
181
- </tr>
182
-
183
- <tr>
184
-
185
- <td bgcolor="#FF9999" class="j14">備考</td>
186
-
187
- <td colspan="5"><br></td>
188
-
189
- </tr>
190
-
191
- </form>
192
-
193
- </table>
194
-
195
- '=================================ここまでです。=================================
196
-
197
-
198
-
199
- </td>
200
-
201
- </tr>
202
-
203
- </table>
204
-
205
- </td>
206
-
207
- </tr>
208
-
209
- <tr>
210
-
211
- <td> </td>
212
-
213
- </tr>
214
-
215
- <tr>
216
-
217
- <td bgcolor="#EF962F" height="1"><img src="image/head/spacer.gif" width="605" height="1"></td>
218
-
219
- </tr>
220
-
221
- </table>
222
-
223
- </body>
224
-
225
-
226
-
227
- <該当VBA>
228
-
229
- 'フレーム情報取得
230
-
231
- Dim objFRAME As FramesCollection
232
-
233
- Set objFRAME = objIE.Document.frames
234
-
235
-
236
-
237
- Dim objDOC As HTMLDocument
238
-
239
- Set objDOC = objFRAME("mainFrame").Document
240
-
241
-
242
-
243
- 'ページ表示待機
244
-
245
- waitTime = Now + TimeValue("0:00:01")
246
-
247
- Application.Wait waitTime
248
-
249
-
250
-
251
- '商品コードを入力
252
-
253
- Dim txtInput As String
254
-
255
- Set txtInput = objDOC.getElementsByName("txtSyohincd")
256
-
257
- txtInput.Value = Cells(i, 2)
258
-
259
-
260
-
261
-
262
-
263
- <環境>
264
-
265
- Windows7 Professional 32bit
266
-
267
- Microsoft Office 2010 Excel
268
-
269
- Internet Explorer 11
270
-
271
-
272
-
273
- 3/8変更しました。
274
-
275
- よろしくお願いいたします。

1

確認したところ、IE側でFrameが使用されておりましたので、問題箇所を明確にしました。

2017/03/08 08:07

投稿

hatsuk0i1216
hatsuk0i1216

スコア14

test CHANGED
File without changes
test CHANGED
@@ -1,14 +1,54 @@
1
1
  ###前提・実現したいこと
2
2
 
3
+ 在庫数確認のため、WEBページにアクセス
4
+
5
+
6
+
7
+ ログイン
8
+
9
+
10
+
11
+ 在庫確認ページへアクセス
12
+
13
+
14
+
3
- 現在VBA使用てマクロを作成しておます。
15
+ 商品コードセルから取り出付け
16
+
4
-
17
+ 問い合わせボタンを押す
18
+
19
+
20
+
5
- IEを立ち上げ⇒ログイン⇒在庫検索ページへ遷移⇒品番の入力・送信⇒出力された在庫数をエクセルへ貼り付けを繰り返す。
21
+ 出力された情報をエクセルへ貼り付け
22
+
23
+
6
24
 
7
25
 
8
26
 
9
27
  ###発生している問題・エラーメッセージ
10
28
 
29
+ 在庫確認ページへアクセスすると、framesetが2つ表示となっており、
30
+
31
+ 実際の商品コードで問い合わせたいページはstock.aspとなっている。
32
+
33
+
34
+
11
- 品番の入力の時点で、「オブジェトが必要でいうエラーが出てセル値が返されません
35
+ stock.aspへ直接アセスしようとと、index.htmlへ強制的飛ばされ
36
+
37
+
38
+
39
+ 「アプリケーション定義またはオブジジェクト定義のエラーです。
40
+
41
+ データ型を数値もしくは文字列形に変更すると、
42
+
43
+ 「コンパイルエラー オブジェクトが必要です。」
44
+
45
+ となります。
46
+
47
+ 実際に代入される値は文字列なのですが・・・。
48
+
49
+ ここではどれを入れればよろしいのでしょうか・・・。
50
+
51
+ (integer long object string variantはすべて試しました。)
12
52
 
13
53
 
14
54
 
@@ -16,13 +56,207 @@
16
56
 
17
57
  <該当HTML>
18
58
 
59
+ □在庫確認ページ
60
+
61
+ <html>
62
+
63
+ <head>
64
+
65
+ <title>- ********************* -</title>
66
+
67
+ <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
68
+
69
+ </head>
70
+
71
+
72
+
73
+ <frameset rows="80,*" frameborder="NO" border="0" framespacing="0">
74
+
75
+ <frame name="topFrame" scrolling="NO" noresize src="stock_head.html" marginwidth="0" marginheight="0">
76
+
77
+ <frame name="mainFrame" src="stock.asp" marginwidth="0" marginheight="0"></frameset>
78
+
79
+
80
+
81
+ <noframes>
82
+
83
+ <body bgcolor="#FFFFFF" text="#000000">
84
+
85
+ </body>
86
+
87
+ </noframes>
88
+
89
+
90
+
91
+ </html>
92
+
93
+ □stock.aspのページ
94
+
95
+ <body style="background:white url(*********************.gif) no-repeat top left;" text="#000000">
96
+
97
+ <table width="744" border="0" cellspacing="0" cellpadding="0" align="center">
98
+
99
+ <tr><td>
100
+
101
+ <table width="605" border="0" align="center">
102
+
103
+ <tr><td height="80"> </td></tr>
104
+
105
+
106
+
107
+ '=================================下記からが触りたい部分です。============================
108
+
109
+ <tr>
110
+
111
+ <td align="right">
112
+
113
+ <table style="width:600px;" border="1" cellspacing="0" cellpadding="2" bordercolor="#000000" bordercolorlight="#FFFFFF" bgcolor="#FFFFFF">
114
+
115
+ <form method="post" action="stock.asp">
116
+
117
+ <tr>
118
+
119
+ <td bgcolor="#FF9999" style="width:100px;" class="j14">商品コード</td>
120
+
121
+ <td colspan="2" style="width:200px;">
122
+
19
- <input type="text" name="strNUMBER" size="15" value="" maxlength="12" style="width:100px;">
123
+ <input type="text" name="txtSyohincd" size="15" value="" maxlength="12" style="width:100px;">
124
+
125
+ <input type="submit" value="問合せ" name="cmdQuery" class="j12">
126
+
127
+ </td>
128
+
129
+ <td bgcolor="#FF9999" style="width:100px;" class="j14">メーカー品番</td>
130
+
131
+ <td colspan="2" style="width:200px"><br></td>
132
+
133
+ </tr>
134
+
135
+ <tr>
136
+
137
+ <td bgcolor="#FF9999" class="j14">商品名称</td>
138
+
139
+ <td colspan="5"><br></td>
140
+
141
+ </tr>
142
+
143
+ <tr>
144
+
145
+ <td bgcolor="#FF9999" style="width:100px;" class="j14">単位</td>
146
+
147
+ <td style="width:100px;"><br></td>
148
+
149
+ <td bgcolor="#FF9999" style="width:100px;" class="j14">在庫数</td>
150
+
151
+ <td style="width:100px;"><br></td>
152
+
153
+ <td bgcolor="#FF9999" style="width:100px;" class="j14">標準納期(日)</td>
154
+
155
+ <td style="width:100px;"><br></td>
156
+
157
+ </tr>
158
+
159
+ <tr>
160
+
161
+ <td bgcolor="#FF9999" class="j14">定価</td>
162
+
163
+ <td><br></td>
164
+
165
+ <td bgcolor="#FF9999" class="j14">仕切率(%)</td>
166
+
167
+ <td><br></td>
168
+
169
+ <td bgcolor="#FF9999" class="j14">送料</td>
170
+
171
+ <td><br></td>
172
+
173
+ </tr>
174
+
175
+ <tr>
176
+
177
+ <td bgcolor="#FF9999" class="j14">仕切値</td>
178
+
179
+ <td colspan="5"><br></td>
180
+
181
+ </tr>
182
+
183
+ <tr>
184
+
185
+ <td bgcolor="#FF9999" class="j14">備考</td>
186
+
187
+ <td colspan="5"><br></td>
188
+
189
+ </tr>
190
+
191
+ </form>
192
+
193
+ </table>
194
+
195
+ '=================================ここまでです。=================================
196
+
197
+
198
+
199
+ </td>
200
+
201
+ </tr>
202
+
203
+ </table>
204
+
205
+ </td>
206
+
207
+ </tr>
208
+
209
+ <tr>
210
+
211
+ <td> </td>
212
+
213
+ </tr>
214
+
215
+ <tr>
216
+
217
+ <td bgcolor="#EF962F" height="1"><img src="image/head/spacer.gif" width="605" height="1"></td>
218
+
219
+ </tr>
220
+
221
+ </table>
222
+
223
+ </body>
20
224
 
21
225
 
22
226
 
23
227
  <該当VBA>
24
228
 
229
+ 'フレーム情報取得
230
+
231
+ Dim objFRAME As FramesCollection
232
+
233
+ Set objFRAME = objIE.Document.frames
234
+
235
+
236
+
237
+ Dim objDOC As HTMLDocument
238
+
25
- objIE.Document.Forms(0).Item("strNUMBER").Value = Cells(1, 2).Value
239
+ Set objDOC = objFRAME("mainFrame").Document
240
+
241
+
242
+
243
+ 'ページ表示待機
244
+
245
+ waitTime = Now + TimeValue("0:00:01")
246
+
247
+ Application.Wait waitTime
248
+
249
+
250
+
251
+ '商品コードを入力
252
+
253
+ Dim txtInput As String
254
+
255
+ Set txtInput = objDOC.getElementsByName("txtSyohincd")
256
+
257
+ txtInput.Value = Cells(i, 2)
258
+
259
+
26
260
 
27
261
 
28
262
 
@@ -30,10 +264,12 @@
30
264
 
31
265
  Windows7 Professional 32bit
32
266
 
33
- Microsoft Office 2010 Excel 使用
267
+ Microsoft Office 2010 Excel
34
-
268
+
35
- IE11
269
+ Internet Explorer 11
270
+
271
+
272
+
36
-
273
+ 3/8変更しました。
37
-
38
274
 
39
275
  よろしくお願いいたします。