视觉基础知识没有为下划线开头的变量赋值

时间:2019-02-22 07:21:49

标签: excel

  

大家好,

实际上,我试图通过使用Visual Basics Excel对网站进行身份验证来自动化一项任务。 退货 这样做时,我需要分配该网站的用户ID和密码字段,但用户ID和密码的命名约定以下划线和数字开头,例如-_58_login(用于用户名)和_58_password(用于密码),因此当我尝试分配值,例如HTMLDoc.all._58_login.Value =“ xyz”,它用红色突出显示,并开始给出编译错误。 请为此提出解决方案

<pre><code>
Dim MyBrowser As InternetExplorer
 Sub MyAuthentication()
Dim MyHTML_Element As IHTMLElement

Dim MyURL As String
MyURL = "http://ustr-erl-9026.na.uis.xyz.com:8080/web/xyz/home"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate MyURL
MyBrowser.Visible = True
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.document
HTMLDoc.all._58_login.Value = "xyz"
HTMLDoc.all._58_Password.Value = "xyz"
For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click: Exit For
Next

End Sub

</code></pre>

0 个答案:

没有答案