我正在尝试使用VBA点击网络上的客户名称或客户编号单选按钮,但运气不错。我收到错误"对象变量或没有设置块变量"。任何帮助非常感谢! 我的代码如下:
Set HTMLdoc = IE.Document
With IE.Document
.getElementsByName("mainTabView:searchtype").Item(0).Checked = True
End With
以下是客户编号和客户名称单选按钮所在的HTML源代码:
<div class="radioButtonContainer">
<div class="ui-radiobutton ui-widget" id="mainTabView:customerNumberOption">
<div class="ui-helper-hidden-accessible">
<input name="mainTabView:searchType" tabindex="-110" id="mainTabView:searchType:0" type="radio" checked="checked"
value="false"></input>
</div>
<div class="ui-radiobutton-box ui-widget ui-corner-all ui-state-default ui-state-active">
<span class="ui-radiobutton-icon ui-icon ui-icon-bullet"></span>
</div>
</div>
<label class="ui-outputlabel ui-widget" id="mainTabView:j_id1942712369_6a329e5d" for="mainTabView:customerNumberOption">Number</label>
<div class="ui-radiobutton ui-widget" id="mainTabView:customerNameOption">
<div class="ui-helper-hidden-accessible">
<input name="mainTabView:searchType" tabindex="-110" id="mainTabView:searchType:1" type="radio" value="true">
</div>
<div class="ui-radiobutton-box ui-widget ui-corner-all ui-state-default">
<span class="ui-radiobutton-icon"></span>
</div>
</div>
<label class="ui-outputlabel ui-widget" id="mainTabView:j_id1942712369_6a329db2" for="mainTabView:customerNameOption">Name</label>
<div style="width: 40px; height: 1px;"></div>
<div class="ui-chkbox ui-widget" id="mainTabView:includePublicCheckbox">
<div class="ui-helper-hidden-accessible">
<input name="mainTabView:includePublicCheckbox_input" tabindex="-120" id="mainTabView:includePublicCheckbox_input" type="checkbox">
</div>
<div class="ui-chkbox-box ui-widget ui-corner-all ui-state-default">
<span class="ui-chkbox-icon ui-c"></span>
</div>
</div><label class="ui-outputlabel ui-widget" id="mainTabView:j_id1942712369_6a329df5" for="mainTabView:includePublicCheckbox_input">Include Open
Tariffs</label>
</div>
&#13;