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

質問編集履歴

4

投稿ルールに従いました。またコード間違いを修正しました。

2018/10/21 13:54

投稿

haruno_uchida
haruno_uchida

スコア12

title CHANGED
File without changes
body CHANGED
@@ -34,7 +34,6 @@
34
34
  End If
35
35
 
36
36
  **Set oHttp = CreateObject("MSXML2.ServerXMLHTTP")**
37
-
38
37
  With CreateObject("VBScript.RegExp")
39
38
  .Pattern = ">([^<>]+)<"
40
39
  .Global = True

3

投稿ルールに従いました。またコード間違いを修正しました。

2018/10/21 13:54

投稿

haruno_uchida
haruno_uchida

スコア12

title CHANGED
File without changes
body CHANGED
@@ -16,6 +16,7 @@
16
16
 
17
17
  ```VBA
18
18
  Const urlk1 As String = "https://info.finance.yahoo.co.jp/history/?code=4762.T"
19
+
19
20
  Sub 取得1()
20
21
  Dim oHttp As Object
21
22
  Dim dthtml As String
@@ -59,4 +60,5 @@
59
60
  End With
60
61
  Set oHttp = Nothing
61
62
  DoEvents
62
- End Sub
63
+ End Sub
64
+ ```

2

投稿ルールに従いました。またコード間違いを修正しました。

2018/10/21 13:53

投稿

haruno_uchida
haruno_uchida

スコア12

title CHANGED
@@ -1,1 +1,1 @@
1
- 正規表現で株価を取得
1
+ 正規表現でWEBからデータを取得しようとするとsendメソッドでエラーが出る
body CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  ### 発生している問題・エラーメッセージ
5
5
  Set oHttp = CreateObject("MSXML2.ServerXMLHTTP")が上手くいかないのか
6
- oHttp.Sendのところで「実行時エラー'-2147012867 サーバーに接続できませんでした」とでてきます。
6
+ 下記oHttp.Sendのところで「実行時エラー'-2147012867 サーバーに接続できませんでした」とでてきます。
7
7
  どなたか解決方法をご存知の方がいらっしゃればご教示お願いできませんでしょうか。
8
8
  よろしくお願いいたします。
9
9
 
@@ -14,10 +14,8 @@
14
14
 
15
15
  ### 該当のソースコード
16
16
 
17
- ---
18
17
  ```VBA
19
18
  Const urlk1 As String = "https://info.finance.yahoo.co.jp/history/?code=4762.T"
20
- ---
21
19
  Sub 取得1()
22
20
  Dim oHttp As Object
23
21
  Dim dthtml As String
@@ -55,13 +53,10 @@
55
53
 
56
54
  With .Execute(dthtml)
57
55
  For j = 1 To itmsu
58
- ' Debug.Print j, .Item(j).SubMatches(0)
59
56
  hdat(j + hosei) = .Item(j).SubMatches(0)
60
57
  Next j
61
58
  End With
62
- ' On Error GoTo 0
63
59
  End With
64
60
  Set oHttp = Nothing
65
61
  DoEvents
66
- End Sub
62
+ End Sub
67
- ```

1

コードが一部間違っておりました。失礼いたしました。

2018/10/21 13:51

投稿

haruno_uchida
haruno_uchida

スコア12

title CHANGED
File without changes
body CHANGED
@@ -13,8 +13,11 @@
13
13
  Set oHttp = CreateObject("MSXML.XMLHTTP")
14
14
 
15
15
  ### 該当のソースコード
16
+
16
- --------------------------------
17
+ ---
18
+ ```VBA
17
- Const URLYAHOO As String = "https://info.finance.yahoo.co.jp/history/?code=4762.T"
19
+ Const urlk1 As String = "https://info.finance.yahoo.co.jp/history/?code=4762.T"
20
+ ---
18
21
  Sub 取得1()
19
22
  Dim oHttp As Object
20
23
  Dim dthtml As String
@@ -60,6 +63,5 @@
60
63
  End With
61
64
  Set oHttp = Nothing
62
65
  DoEvents
63
- Call 貼付
64
66
  End Sub
65
- --------------------------------
67
+ ```