- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
本帖最後由 GBKEE 於 2020-5-10 15:20 編輯
回復 3# t8899
- Option Explicit
- Sub Ex()
- Dim R As Integer, C As Integer
- With New InternetExplorer '**設定引用項目加入--> Microsoft Internet Controls***
- .Visible = True
- .Navigate "https://pchome.megatime.com.tw/rank/sto0/ock03.html"
- Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
- '<table style="margin-top: 10px;" cellspacing="1" cellpadding="0" **網頁的內容**
- With .Document.querySelector("table[style='margin-top: 10px;'][cellspacing='1'][cellpadding='0']")
- '' With .Document.all.tags("table")(0) '** 也可以
- For R = 0 To .Rows.Length - 1
- For C = 0 To .Rows(R).Cells.Length - 1
- ActiveSheet.Cells(R + 1, C + 1) = .Rows(R).Cells(C).innerText
- Next
- Next
- End With
- .Quit
- End With
- End Sub
複製代碼 |
|