2015-12-09 63 views
0
</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代码。在vba中使用Internet Explorer窗体

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包含当前日期

+0

试'IE.document.getElementById(” ReportViewerControl_ctl04_ctl07" )。第(0)= 12345' –

+0

'IE.document.getElementById(“ReportViewerControl_ctl04_ctl07_txtValue”)。value =“12345”' – omegastripes

+0

我有另一个日期输入框,但我用日期框相同的东西。它显示错误“对象不支持此属性或方法” –

回答

0
IE.Document.getElementById("ctl32_ctl04_ctl03_txtValue").value = SDate 
相关问题