【发布时间】:2015-08-27 17:47:59
【问题描述】:
我正在尝试自动填写 USPS 网络表单,它适用于街道地址、城市和邮政编码,但我无法让它填写州下拉菜单。有什么想法吗?
这是我目前拥有的代码:
Sub USPS()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "https://tools.usps.com/go/ZipLookupAction!input.action?mode=1&refresh=true"
Do
DoEvents
Loop Until IE.READYSTATE = 4
Call IE.Document.getElementByID("tAddress").SetAttribute("value", "2 Peabody Terrace")
Call IE.Document.getElementByID("tCity").SetAttribute("value", "Cambridge")
Call IE.Document.getElementByID("sState").SetAttribute("value", "MA")
Call IE.Document.getElementByID("Zzip").SetAttribute("value", "02138")
Set AllHyperLinks = IE.Document.GetElementsByTagName("A")
For Each hyper_link In AllHyperLinks
If ID = "lookupZipFindBtn" Then
hyper_link.Click
Exit For
End If
Next
End Sub
非常感谢您的帮助!
【问题讨论】: