返回列表 上一主題 發帖

[發問] 如何將從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

回復 5# icestormer
我手頭上並沒有 2003 的版本,有關這方面
你可能要去請教 GBKEE 版大了,因為他也是
使用 2003 的版本。

TOP

回復 7# icestormer
我只會對案例回復,至於平常如何呼叫真的不知如何聯繫。
但我找到了兩篇有關解決方案,提供你參考:
  1. Actually it's a member of msforms library, not from native vba.

  2. you can use it without a userform but you'll need a reference
  3. to Microsoft Forms Object Library. The reference is automatically added
  4. to a workbook when you insert a Userform from VBeditor's Insert menu.
複製代碼
  1. Problem

  2. An Excel VBA subroutine that involves interaction with the Windows Clipboard fails to run with the error:
  3. “Compile error: User-defined type not defined.”  The line of code highlighted by Excel as
  4. being the cause of the error includes a reference to the “DataObject” object type.

  5. Solution

  6. (Tested on my machine with Excel 2003 SP3)

  7. In the Microsoft Visual Basic editor:

  8.     Stop debugging by clicking the “Stop” button on the toolbar (if debugging isn’t already stopped).
  9.     Tools menu | References
  10.     In the list of available references, find “Microsoft Forms 2.0 Object Library”, check it, and click OK.  (For me, this was the 2nd unchecked item from the top of the list; it wasn’t sorted alphabetically in the list like most of the rest of the listed items.)
  11.     Run the macro again.

  12. That’s it!  Hope this helps!
複製代碼

TOP

回復 7# icestormer
為方便閱覽,特將它翻譯如下:
  1.     Actually it's a member of msforms library, not from native vba.
  2.     (確實它是微軟表單程式庫的乙員,而非 VBA 的生成元件)

  3.     you can use it without a userform but you'll need a reference
  4.     to Microsoft Forms Object Library. The reference is automatically added
  5.     to a workbook when you insert a Userform from VBeditor's Insert menu.
  6.     (你可以不需表單而去使用它,但是你還是須要參考到微軟的表單物件程式庫。
  7.      當你從VB編輯插入選單內插入一張表單時,此參考項會自動加入到活頁簿裡。)


  8.     Problem (問題)

  9.     An Excel VBA subroutine that involves interaction with the Windows Clipboard fails to run with the error:
  10.     “Compile error: User-defined type not defined.”  The line of code highlighted by Excel as
  11.     being the cause of the error includes a reference to the “DataObject” object type.
  12.     (當一個試算表 VBA 程式段內涵蓋視窗剪貼簿之鏈結於執行時產生錯誤:"程式編輯錯誤:使用者自訂型態尚未定義"。
  13.      反白標示發生錯誤的這行是在說明它在參照 "資料物件 (“DataObject”)" 時發生了參照錯誤。)

  14.     Solution (解決方案)

  15.     (Tested on my machine with Excel 2003 SP3) (已經在Excel 2003 SP3測試過)

  16.     In the Microsoft Visual Basic editor: (在微軟的 VB 編輯器內)

  17.         Stop debugging by clicking the “Stop” button on the toolbar (if debugging isn't already stopped).
  18.         (停止偵錯模式,即選按工作列上的 "停止" 鈕終止偵錯)
  19.         Tools menu | References  (工具菜單  |  參考項目 )
  20.         In the list of available references, find “Microsoft Forms 2.0 Object Library”, check it, and click OK.
  21.         在參考列示項目選單內,找尋“Microsoft Forms 2.0 Object Library”,找到後點選它就完成了。
  22.         (For me, this was the 2nd unchecked item from the top of the list; it wasn't sorted alphabetically
  23.          in the list like most of the rest of the listed items.)
  24.         Run the macro again. (再重新執行巨集)

  25.     That's it!  Hope this helps!  (就這樣! 希望對你有所幫助!)
複製代碼

TOP

回復 11# icestormer
  1.       '  MsgBox x.All.tags("h4")(0).innerText
  2.       [L22] = x.All.tags("h4")(0).innerText
複製代碼

TOP

        靜思自在 : 修行要繫緣修心,藉事練心,隨處養心。
返回列表 上一主題