我尝试了两种 VBA XML 方法来登录 USGA 网站,看起来很简单,但都不起作用?!要对此进行测试,您将需要自己的 GHIN 号码和姓氏。有人可以指出我是如何搞砸的吗?网站=“ https://www.ghin.com/login ”Sub Get_GHIN_Data()Dim request As ObjectDim response As StringDim html As New HTMLDocumentDim website As StringDim price As Variantwebsite = "https://www.ghin.com/login"Set request = CreateObject("MSXML2.XMLHTTP")request.Open "GET", website, False'request.setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"request.sendresponse = StrConv(request.responseBody, vbUnicode)html.body.innerHTML = response'********* Method 1 ************************************'Dim oLogin As Object, oPassword As Object'Set oLogin = .document.getElementsByName("ghinNumber")(0)'Set oPassword = .document.getElementsByName("lastName")(0)'oLogin.Value = ghinNumber 'real GHIN NUMBER'oPassword.Value = LastName 'real Last Name'html.document.forms(0).submit'********* Method 2 ************************************'html.getElementById("ghinNumber").Value = "ghinNumber" 'real GHIN NUMBER'html.getElementById("lastName").Value = "Last name" 'real Last Name'html.getElementClassName("btn fill cardinal").Click'html.forms(0).submitEnd Sub
目前暂无任何回答
- 0 回答
- 0 关注
- 87 浏览
添加回答
举报
0/150
提交
取消