iT邦幫忙

0

excel vba 讀取網頁資料win7可以win10 卻不行 請教高手 可以幫我改改嗎

  • 分享至 

  • xImage

vba 碼 如下:

   URLb = "https://www.taifex.com.tw/cht/3/futContractsDateExcel"
   Set ie = CreateObject("internetexplorer.application")
    On Error Resume Next  
   ie.Visible = False   '  是否顯示 IE

   ie.Navigate URLb
   Do While ie.readyState <> 4 Or ie.Busy: DoEvents: Loop
  
   
    Application.Wait Now + TimeValue("00:00:03") '等待頁面,過快會找不到資料

      Dim DArray(20) As Variant  '陣列暫存

DArray(1) = Trim(ie.document.getelementsbytagname("td")(27).innertext)

' office2003 可以 2019 不行

有錯誤訊息嗎?
我只想知道。為何vba會跟作業系統有直接關係呢??
理論上是跟OFFICE的版本有關係才對吧??
blanksoul12 iT邦研究生 5 級 ‧ 2022-02-18 09:17:47 檢舉
1.有打開過 ie 嗎?
2.set 長點等待時間也不行嗎?
3.學 xmlhttp
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
海綿寶寶
iT邦大神 1 級 ‧ 2022-02-16 16:59:50

https://ithelp.ithome.com.tw/upload/images/20220216/20001787wyasGElsaP.png

尼克 iT邦大師 1 級 ‧ 2022-02-16 17:29:34 檢舉

/images/emoticon/emoticon01.gif

/images/emoticon/emoticon01.gif

ccenjor iT邦高手 1 級 ‧ 2022-02-16 20:55:35 檢舉

/images/emoticon/emoticon01.gif

我要發表回答

立即登入回答