返回列表 上一主題 發帖

[發問] 如何將從EXCEL內的資料貼入網站中(過程都由VBA自動執行)

回復 3# icestormer
如 stillfish00 之解說: 使用 DataObject 宣告,須引用 Microsoft Form Object Library
你先檢查該 Library 是否已經勾選, 否則執行時會產生 "未定義" 的訊息,我將如何引用
的方法,說明如下,希望對你會有所幫助。
  1. 1.  開發人員  --->   工具   --->  設定引用項目   --->   可引用的項目(A)
  2. 2.  然後觀察 Micorsoft Forms 2.0 Ojbect Library 有否勾選?
  3. 3.  如果該項目不存在!
  4. 4.  則點選 "瀏覽" 選鈕   --->   新增引用項目 - VBAProject,
  5.     搜尋位置(I) 指向 Windows/System32\FM20.dll, 接著再點選
  6.     "開啟" 便會自動勾選 Micorsoft Forms 2.0 Ojbect Library 了。
複製代碼
祝你一帆風順!

TOP

回復 2# stillfish00


   


你好 我不太懂問題出在那 但我才跑第一行就出現 上圖的問題 請問我要怎做呢??

TOP

本帖最後由 stillfish00 於 2013-10-18 16:22 編輯

回復 1# icestormer
  1. Sub Test()
  2.   Dim oIe, myData As DataObject, x
  3.   
  4.   Set myData = New DataObject  '需引用 MS Form Object Library
  5.   
  6.   With Sheets("問題")
  7.     .Range(.[A4], .[F4].End(xlDown)).Copy
  8.   End With
  9.   myData.GetFromClipboard
  10.   
  11.   Set oIe = CreateObject("internetExplorer.Application")
  12.   With oIe
  13.     '.Visible = False
  14.     .navigate "http://www.evepraisal.com"
  15.     Do While oIe.readystate <> 4: DoEvents: Loop
  16.    
  17.     .document.getElementById("raw_textarea").innerText = myData.GetText '填入
  18.     .document.getElementById("result_submit").Click 'submit
  19.    
  20.     Application.Wait Now + TimeValue("00:00:05")  '等待5秒完成
  21.    
  22.     Set x = .document.getElementById("result_container")
  23.     MsgBox x.All.tags("h4")(0).innerText
  24.     .Quit
  25.   End With
  26.   
  27. End Sub
複製代碼

TOP

        靜思自在 : 謊言像一朵盛開的鮮花,外表美麗,生命短暫。
返回列表 上一主題