使用MS Access VBA提交HTML表单

时间:2014-01-24 01:55:33

标签: html access-vba

我在Access数据库表单中编写了以下表单。

Function Submit_Web_Form()

Dim ie As Object

Set ie = CreateObject("internetexplorer.application")

  ie.navigate "http://www.webstaurantstore.com/bakers-pride-bco-e2-cyclone-series-electric-convection-oven-double-deck/155BCOE2.html"

  ie.Visible = True

While ie.busy
   DoEvents
Wend

ie.Document.all("from").Value = "Add"
ie.Document.all("weight").Value = "0"
ie.Document.all("price").Value = "5400.00"
ie.Document.all("description").Value = "Bakers%20Pride%20BCO%2DE2%20Cyclone%20Series%20Electric%20Convection%20Oven%20Double%20Deck"
ie.Document.all("uom").Value = "Each"
ie.Document.all("shipping").Value = "C"
ie.Document.all("taxcode").Value = "Y"
ie.Document.all("mnbuy").Value = "1"
ie.Document.all("mxbuy").Value = "1"
ie.Document.all("suffix").Value = "Voltage"
ie.Document.all("group").Value = "Y"
ie.Document.all("item_number").Value = "155BCOE2    240/1"
ie.Document.all("qty").Value = "1"
ie.Document.Forms(0).submit

While ie.busy
   DoEvents
Wend

Set ie = Nothing

End Function

虽然该函数不会产生任何错误,但它不会提交表单。我需要自动将产品添加到购物车中。

有没有人有通过VBA使用网页的经验?

先谢谢!

1 个答案:

答案 0 :(得分:0)

您需要使用HTML对象库。请看一下我前一段时间写的这篇文章:Access and the web HTML Object Library。如果您决定使用这种方法,我可以进一步帮助您。

此致