簡體   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