返回列表 上一主題 發帖

web匯入外部資料後..超連結文字消失

回復 1# go2hk
  1. Option Explicit
  2. Sub Ex()
  3.     Dim IE As New InternetExplorer, URL As String, A As Object
  4.     '宣告 Dim ie As New InternetExplorer
  5.     '須在工具-> 設定引用項目加入 新增引用 Microsoft Internet Controls
  6.     URL = "http://stockchannel.sinotrade.com.tw/z/zg/zge/zge_EH000027_1.djhtm"
  7.     With IE
  8.         .Navigate URL
  9.       '  .Visible = True
  10.         Do While .Busy Or .readyState <> 4:         Loop
  11.         Set A = .document.getElementsByTagName("TABLE")
  12.         Ep A(2).outerHTML
  13.         .Quit
  14.     End With
  15. End Sub
  16. Sub Ep(S As String)
  17.     Dim D As New DataObject
  18.     'DataObject 物件 在進行轉換動作時,做為格式化文字資料的暫存區域。其也可以暫存和儲存在 DataObject 的文字片段相關的格式。
  19.     '宣告 Dim D As New DataObject
  20.     '須在工具-> 設定引用項目加入 新增引用 Microsoft Forms 2.0 Object Library ,專案 加入一表單即可
  21.     With D
  22.         .SetText S
  23.         .PutInClipboard
  24.         With ActiveSheet
  25.             .UsedRange.Clear
  26.              .Paste .[A1]
  27.             .Shapes.SelectAll
  28.             Selection.Delete
  29.             .Hyperlinks.Delete
  30.         End With
  31.     End With
  32. End Sub
複製代碼
感恩的心......(在麻辣家族討論區.用心學習會有進步的)
但資源無限,後援有限,  一天1元的贊助,人人有能力.

TOP

        靜思自在 : 小事不做、大事難成。
返回列表 上一主題