返回列表 上一主題 發帖

[發問] Web更新網頁,會跑出 2組出來 (黃色)

本帖最後由 GBKEE 於 2018-9-5 15:23 編輯

回復 1# 7777
  1. Option Explicit
  2. Sub EX_網頁()
  3.     Dim oXmlhttp As Object, oHtmldoc As Object, E As Object, R As Integer, C As Integer
  4.     Dim I As Integer, AR(1 To 2)
  5.     AR(1) = "http://info512.taifex.com.tw/Future/FusaQuote_Norl.aspx"
  6.     AR(2) = "http://info512.taifex.com.tw/Future/OptQuote_Norl.aspx"
  7.     Cells.Clear
  8.     For I = 1 To 2
  9.         Set oXmlhttp = CreateObject("msxml2.xmlhttp")
  10.         Set oHtmldoc = CreateObject("htmlfile")
  11.         With oXmlhttp
  12.             .Open "Get", AR(I), False
  13.             .send
  14.             oHtmldoc.write .responseText
  15.         End With
  16.         Set E = oHtmldoc.all.tags("TABLE")( 12))
  17.         For R = 0 To E.Rows.Length - 1
  18.             For C = 0 To E.Rows(R).Cells.Length - 1
  19.                 With IIf(I = 1, [A26], [T26])
  20.                 .Cells(R + 1, C + 1) = E.Rows(R).Cells(C).innerText
  21.                 End With
  22.             Next
  23.         Next
  24.         Set oXmlhttp = Nothing
  25.         Set oHtmldoc = Nothing
  26.     Next
  27. End Sub
複製代碼
感恩的心......(在麻辣家族討論區.用心學習會有進步的)
但資源無限,後援有限,  一天1元的贊助,人人有能力.

TOP

        靜思自在 : 人生不一定球球是好球,但是有歷練的強打者,隨時都可以揮棒。
返回列表 上一主題