繁体   English   中英

在VBA中处理Internet Explorer表单

[英]Working on Internet explorer form in vba

 </tr><tr IsParameterRow="true">
<td class="ParamLabelCell"><label for="ReportViewerControl_ctl04_ctl07_txtValue"><span>Enter Number</span></label></td><td class="ParamEntryCell" style="padding-right:0px;"><div id="ReportViewerControl_ctl04_ctl07">
                                    <input name="ReportViewerControl$ctl04$ctl07$txtValue" type="text" size="30" id="ReportViewerControl_ctl04_ctl07_txtValue" disabled="disabled" class="DisabledTextBox" />
                                </div></td>
                            </tr>

对于上述HTML代码,我无法在vba中输入数字。 请提出建议。 以下是用于输入数据的VBA代码。

sub my()
Dim IE As Object
Dim objElement As Object
Dim objCollection As Object

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate Link
Do While IE.Busy
    Application.Wait DateAdd("s", 1, Now)
Loop
IE.document.getElementsById("ReportViewerControl_ctl04_ctl07_txtValue") = 12345
End Sub()




<td class="ParamLabelCell"><label for="ReportViewerControl_ctl04_ctl03_txtValue"><span>Enter Start Date Here</span></label></td><td class="ParamEntryCell" style="padding-right:0px;"><div id="ReportViewerControl_ctl04_ctl03">
                                    <div onactivate="event.cancelBubble=true;" style="white-space:nowrap;">
                                        <input name="ReportViewerControl$ctl04$ctl03$txtValue" type="text" value="11/29/2015" size="28" onchange="javascript:setTimeout('__doPostBack(\'ReportViewerControl$ctl04$ctl03$txtValue\',\'\')', 0)" onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="ReportViewerControl_ctl04_ctl03_txtValue" disabled="disabled" class="DisabledTextBox" />&nbsp;<input src="/ReportServer/Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=11.0.5058.0&Name=Microsoft.Reporting.WebForms.calendar_disabled.gif" name="ReportViewerControl$ctl04$ctl03$ddDropDownButton" type="image" id="ReportViewerControl_ctl04_ctl03_ddDropDownButton" alt="Select a value" title="Select a value" style="cursor:pointer;" disabled="disabled" />
                                    </div>
                                </div></td>

我有另一个日期输入框,但我在日期框中使用的是同一输入框。 其显示错误“对象不支持此属性或方法

 IE.document.getElementById("ReportViewerControl_ctl04_ctl03").Value = sdate

sdate包含当前日期

IE.Document.getElementById("ctl32_ctl04_ctl03_txtValue").value = SDate

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM