มีคำสั่ง VBA เพื่อโหลด web เข้ามาเก็บไหมครับ
กระทู้เก่าบอร์ด อ.Yeadram

 1,276   1
URL.หัวข้อ / URL
มีคำสั่ง VBA เพื่อโหลด web เข้ามาเก็บไหมครับ

หมายถึงโหลด รหัส (Code) ของ WEB Site ซึ่งหมายถึง Code HTML น่ะครับ     โหลดเข้าตัวแปร String แล้วผมจะถอด/แปล ข้อความใน String นั้นอีกทีหนึ่ง      

ผมกำลังเขียน VBA อ่านข้อมูลหุ้นจาก WEB ของตลาดหลักทรัพย์ ที่มีความเคลื่อนไหลขณะกำลังซื้อ-ขาย ทุก ๆ   10 วินาที จะอ่านครั้งหนึ่ง แล้วนำข้อมูลที่ได้ไปคำนวน และ เขียนบันทึกใน TABLE ของ Access แต่มาติดปัญหาตรงนี้น่ะครับ

1 Reply in this Topic. Dispaly 1 pages and you are on page number 1

1 @R23760
ลองนี่จ้ะ ค้นมา ขออนุญาตลงจ้า
ลองประยุกต์ใช้นะ

Dim ie As Object
Dim html As Object
Dim j As Integer
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
URL = "google.com"
ie.Navigate URL
Do While ie.ReadyState <> READYSTATE_COMPLETE
Application.StatusBar = "Trying to go to website ..."
Loop
Application.StatusBar = " "
Set html = ie.Document
'Dim htmltext As Collection
Dim htmlElements As Object
Dim htmlElement As Object
Set htmlElements = html.getElementsByTagName("*")
For Each htmlElement In htmlElements
    If htmlElement.getAttribute("href") <> "" Then Debug.Print htmlElement.getAttribute("href")
Next
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.3370s