返回列表 上一主題 發帖

[發問] 如何找出網站原始檔網址

回復 1# blue2263
  1. http://mops.twse.com.tw/mops/web/ajax_stapap1?encodeURIComponent=1&step=1&firstin=1&off=1&queryName=co_id&TYPEK=all&isnew=false&co_id=1101&year=102&month=11
複製代碼
co_id=1101&year=102&month=11  

TOP

回復 1# blue2263
試試看
  1. Option Explicit
  2. Sub 公開資訊網頁()
  3.     Dim A As Object, E As Object
  4.     With CreateObject("InternetExplorer.Application")
  5.         .Visible = True
  6.         ' .Navigate "http://mops.twse.com.tw/mops/web/t164sb04"     '網址:綜合損益表
  7.         .Navigate "http://mops.twse.com.tw/mops/web/stapap1"        '網址:董監事持股餘額明細資
  8.         Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
  9.             .document.getElementById("isnew").Value = "false"       '選擇: 歷史資料
  10.             '註解上一行程式碼為 -> 選擇: 最新資料,不會執行 If 內程式碼
  11.            
  12.             If .document.getElementById("isnew").Value = "false" Then
  13.              .document.getElementById("isnew").FireEvent ("onchange")
  14.                 .document.getElementById("year").Value = "102"       '年度
  15.                 '.document.getElementById("season").Value = "01"    '綜合損益表:第1季(季別)
  16.                 .document.getElementById("month").Value = "08"      '董監事持股餘額明細資料:月份
  17.             End If
  18.             '********************************************************************
  19.            For Each A In .document.getelementSbyTAGNAME("INPUT")
  20.                 If A.Name = "co_id" Then A.Value = "2303"            '股票代號
  21.                 If A.Value = " 搜尋 " Then A.Click                     '按下 搜尋
  22.             Next
  23.             Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
  24.             For Each E In .document.ALL.TAGS("div")
  25.                 If E.ID = "table01" Then
  26.                     .document.body.innerHTML = E.outerHTML
  27.                     .ExecWB 17, 2       '  Select All
  28.                     .ExecWB 12, 2       '  Copy selection
  29.                     With ActiveSheet
  30.                         .Cells.Clear
  31.                         .Cells(1).Select
  32.                         .PasteSpecial Format:="HTML"
  33.                     End With
  34.                 End If
  35.             Next
  36.         .Quit                          '關閉 IE
  37.     End With
  38. End Sub
複製代碼
感恩的心......(在麻辣家族討論區.用心學習會有進步的)
但資源無限,後援有限,  一天1元的贊助,人人有能力.

TOP

        靜思自在 : 【為善競爭】人生要為善競爭,分秒必爭。
返回列表 上一主題