在document中找到element后value属性不能用???
网页源码(嵌套在table、form中的input,还有javascript就没有贴出来了):
<input type='text' name='username' id='username' fieldCaption="用户名" maxlength="24" size="16" value='' checkFlag='true' notnull='true' minvalue='1' maxvalue='24' datatype='string' class="text">
我的VBA代码:
Sub test()
Dim ie As InternetExplorer
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate (公司内网网址)
Do Until ie.readyState = READYSTATE_COMPLETE
DoEvents
Loop
Set doc = ie.Document
Set el = doc.getElementById("username")'运行到这一步都没有问题
a = el.Value'运行到这一步就报错了:运行时错误'91',对象变量或with块变量未设置
End Sub
READYSTATE_COMPLETE换成4,也不行。
value换成innerhtml、innertext都不行。
到底是哪里出了问题?求大神帮忙解惑!